R
Robert Zurer
I want to create a schema element that will allow any element as a child but
that child must contain specified attributes
This example doesn't work but it might give an idea of what I need to do.
<xs:element name="???">
<xs:complexType>
<xs:attribute name="attrOne" type="xs:string" use="required" />
<xs:attribute name"attrTwo" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="parent_element">
<xs:complexType>
<xs:sequence>
<xs:element ref="???" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
This file should be valid
<parent_element>
<hello attrOne="world" attrTwo="planet"/>
<kitty attrOne="cat" attrTwo="feline"/>
</parent_element>
This file should be invalid
<parent_element>
<hello/>
<kitty/>
</parent_element>
I can accomplish the any child element part
<xs:element name="parent_element">
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
But this will not force the elements to have the attributes I need.
Robert Zurer
that child must contain specified attributes
This example doesn't work but it might give an idea of what I need to do.
<xs:element name="???">
<xs:complexType>
<xs:attribute name="attrOne" type="xs:string" use="required" />
<xs:attribute name"attrTwo" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="parent_element">
<xs:complexType>
<xs:sequence>
<xs:element ref="???" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
This file should be valid
<parent_element>
<hello attrOne="world" attrTwo="planet"/>
<kitty attrOne="cat" attrTwo="feline"/>
</parent_element>
This file should be invalid
<parent_element>
<hello/>
<kitty/>
</parent_element>
I can accomplish the any child element part
<xs:element name="parent_element">
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
But this will not force the elements to have the attributes I need.
Robert Zurer