[xml] Making sequence entries option in .xsd files.



Hi,

In the .xsd file for the DLMS Smart Grid protocol I find the following section:

<xsd:complexTypename="InitiateRequest">
<xsd:sequence>
<xsd:elementname="dedicated-key"minOccurs="0"type="xsd:hexBinary"/>
<xsd:elementname="response-allowed"default="true"type="xsd:boolean"/>
<xsd:elementname="proposed-quality-of-service"minOccurs="0"type="Integer8"/>
<xsd:elementname="proposed-dlms-version-number"type="Unsigned8"/>
<xsd:elementname="proposed-conformance"type="Conformance"/>
<xsd:elementname="client-max-receive-pdu-size"type="Unsigned16"/>
</xsd:sequence>
</xsd:complexType>

By the protocol definition, the first 3 items in that sequence should be optional. The minOccurs="0" elements cause items 1 and 3 to be correctly treated as optional. However, the parser in libxml2 2.9.3 treats the second item as a required element. Shouldn't the default setting act in a similar way to a minOccurs="0" element, in making the item optional? Is it always necessary to have minOccurs="0" present when default="something" is present, in order to actually implement the default?

Regards,
Steve



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]