0
votes

I have a xsd file,in which the schema looks something like below:

<xs:complexType name="ABC" final="#all">
  <xs:sequence>
     **<xs:element name="XYZ" type="xs:string"/>**
  </xs:sequence>
</xs:complexType>

what is the issue if i want add attribute use = required to the XYZ element. I always get the following error - The 'use' attribute is not allowed.

Regards

1
I'd use process of elimination. Start removing the child nodes until you don't get the error anymore. Are you trying to read or write the XSD?MacGyver
i am trying to modify the existing xsd file, to make sure that XYZ element is always specified in the xml file.Dexter

1 Answers

1
votes

Use the minOccurs and maxOccurs attributes on xs:element to indicate the minimum and maximum number of occurrences. The default is minOccurs="1", maxOccurs="1".

PS. It looks as if you were guessing. With XSD, guessing won't get you very far; even after years using the language, I still need a reference book by my side.