H
Honza Pazdziora
Hello,
I'm processing documents that can have any element names in them. The
only restriction is placed on the attributes of these elements, each
of them can only have two attributes of given names. I'd like to
validate this input.
I can specify this requirement using xsd:any for /root element, like:
<xsd:element name="root">
<xsd:complexType>
<xsd:sequence>
<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="strict"
namespace="##targetNamespace"/>
</xsd:sequence>
<xsd:attribute name="type" type="xsd:string"/>
<xsd:attribute name="ph" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
However, I'm probably missing a way to specify the
<xsd:element name="root">
as a wildcard matching type. I tried
<xsd:any>
<xsd:complexType>
<xsd:sequence>
<xsd:any minOccurs="1" maxOccurs="unbounded" processContents="strict"
namespace="##targetNamespace"/>
</xsd:sequence>
<xsd:attribute name="type" type="xsd:string"/>
<xsd:attribute name="ph" type="xsd:string"/>
</xsd:complexType>
</xsd:any>
but xsd:any is not allowed directly in xsd:schema.
I'd appreciate any pointer that would help me to specify element type
for wildcard name. Likewise, I tried to find a way to achieve this
with DTD but got stuck in the same place -- specifying the <!ELEMENT>
as a wildcard, matching all element names.
I'm processing documents that can have any element names in them. The
only restriction is placed on the attributes of these elements, each
of them can only have two attributes of given names. I'd like to
validate this input.
I can specify this requirement using xsd:any for /root element, like:
<xsd:element name="root">
<xsd:complexType>
<xsd:sequence>
<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="strict"
namespace="##targetNamespace"/>
</xsd:sequence>
<xsd:attribute name="type" type="xsd:string"/>
<xsd:attribute name="ph" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
However, I'm probably missing a way to specify the
<xsd:element name="root">
as a wildcard matching type. I tried
<xsd:any>
<xsd:complexType>
<xsd:sequence>
<xsd:any minOccurs="1" maxOccurs="unbounded" processContents="strict"
namespace="##targetNamespace"/>
</xsd:sequence>
<xsd:attribute name="type" type="xsd:string"/>
<xsd:attribute name="ph" type="xsd:string"/>
</xsd:complexType>
</xsd:any>
but xsd:any is not allowed directly in xsd:schema.
I'd appreciate any pointer that would help me to specify element type
for wildcard name. Likewise, I tried to find a way to achieve this
with DTD but got stuck in the same place -- specifying the <!ELEMENT>
as a wildcard, matching all element names.