Hi
I am defining a description file for my schema and I want to enforce unique id's. I defined an element as follows in the schema file:
<xsd:element name="Settings">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="ScalarSetting" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="ScalarSetting" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ScalarSetting">
<xsd:complexType>
<xsd:attributeGroup ref="scalarAttributes"/>
</xsd:complexType>
</xsd:element>
<xsd:complexType>
<xsd:attributeGroup ref="scalarAttributes"/>
</xsd:complexType>
</xsd:element>
<xsd:attributeGroup name="scalarAttributes">
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="eid" type="xsd:ID" use="required"/>
</xsd:attributeGroup>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="eid" type="xsd:ID" use="required"/>
</xsd:attributeGroup>
I would like all ScalarSettings defined in a file to have a unique id (eid). When I run the above schema through sourceGenerator it generates the java files. I then compile them and then have a test program that calls unmarshall on a file that has the following:
<Settings>
<ScalarSetting name="NameX" eid="151" type="String"/>
<ScalarSetting name="NameY" eid="151" type="String" />
</Setting
<ScalarSetting name="NameX" eid="151" type="String"/>
<ScalarSetting name="NameY" eid="151" type="String" />
</Setting
I would like the above example to fail because I have two ScalarSetting items with the same eid "151". However, it succeeds. Is there a way to enforce that each value for an eid only appears once in the file (using xsd:ID or some other alternative)?
Thanks
Do you Yahoo!?
Yahoo! Search - Find what you�re looking for faster.
