S
Spaulding
I have an xsd specified as such:
<?xml version="1.0" encoding="UTF-8" ?>
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
- <xs:element name="REQUEST">
- <xs:complexType>
- <xs:all>
<xs:element name="FIELD1" type="xs:string" />
<xs:element name="FIELD2" type="xs:string" />
<xs:element name="FIELD3" type="xs:string" minOccurs="0" />
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
I was thinking that this would allow FIELD3 to be optional and that
FIELD1 and FIELD2 are required. I use JAXB to unmarshal from an XML
doc that does not have FIELD1, and it works. i would have expected an
exception. Am i doing this correctly?
<?xml version="1.0" encoding="UTF-8" ?>
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
- <xs:element name="REQUEST">
- <xs:complexType>
- <xs:all>
<xs:element name="FIELD1" type="xs:string" />
<xs:element name="FIELD2" type="xs:string" />
<xs:element name="FIELD3" type="xs:string" minOccurs="0" />
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
I was thinking that this would allow FIELD3 to be optional and that
FIELD1 and FIELD2 are required. I use JAXB to unmarshal from an XML
doc that does not have FIELD1, and it works. i would have expected an
exception. Am i doing this correctly?