Hi all,
I've got an XSD file that I need to add support to for an optional ID
attribute on elements. After many hours of tweaking all that I get to
work in my XML file is:
<Container id="CT"<!-- Valid ID declaration -->
<Stuff id="CT-1">Foo Bar</Stuff<!-- Invalid ID declaration-->
</Container>
I got this to work by adding an:
<xs:attribute name="id" type="xs:ID"/>
just under by <xs:schema ...line and then:
<xs:complexType name="Container">
<xs:sequence>
<xs:element name="Stuff" type="StuffText" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="id"/<!-- I added this line -->
</xs:complexType>
From what I've read I can do this by declaring the elements separatley
but the schema is quite large at over 50K, so I'm guessing there MUST be
a way to globally declare the use of an optional ID attribute on elements.
If I change the elementFromDefault to "unqualified" I can get the ID to
work but it then breaks other stuff within the XSD.
Can anyone point me in the right direction here please.
Thanks.