Xml – XSD maxOccurs=”unbounded”

xmlxsd

I have generated an XSD file from an XML snippet using xsd.exe /out

What its done is created maxOccurs="unbounded" properties for certain elements.

If I only want the element to appear once, and not be a collection do I set the maxOccurs like this?

maxOccurs="1"

Best Answer

Yes. Of course, keep in mind that maxOccurs is really maximum occurances - there can still be zero. If you want there to always be one, you'll need minOccurs="1" as well.

Related Topic