Christian Schmitt
Christian Schmitt

Reputation: 892

XSD Parser is there a way to omit empty elements?

I have a really complex xsd and now I have something like that:

<xs:element name="name" minOccurs="0" maxOccurs="1" nillable="true"/>

However when validating this xml I need to write is there a way to omit minOccurs="0"? so that I don't need to write it?

Upvotes: 1

Views: 47

Answers (1)

kjhughes
kjhughes

Reputation: 111491

If you omit minOccurs="0", then the element will have to occur at least one time because the default for minOcurrs is 1.

This is different than an empty element. An empty element looks like this:

<name/>

or

<name></name>

Upvotes: 1

Related Questions