Is it possible to define a default value for a missing element in an XML Schema. I have the following snippet:
<xs:element name="protocol" nillable="false" minOccurs="0" default="ftp">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="ftp"/>
<xs:enumeration value="webdav"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
If I have in the XML file
<protocol>ftp</protocol>
or
<protocol>webdav</protocol>
it validates and I obtain the right value. If I have in the XML file
<protocol></protocol>
it also validates and I obtain the default value of ftp.
My searches show that default attribute values apply when attributes are missing, and default element values apply when elements are empty. Is it possible to have a default value for a missing element?
Regards
rambius