tags:

views:

45

answers:

0

How do I fill the default value in my XML during validation against XSD? If my attribute is not defined as use="require" and have default="1", it could be possible to fill these default values from the XSD to the XML.

Example: Original XML:

<a>
 <b/>
 <b c="2"/>
</a>

XSD scheme:

<xs:element name="a">
 <xs:complexType>
  <xs:sequence>
   <xs:element name="b" maxOccurs="unbounded">
    <xs:attribute name="c" default="1"/>
   </xs:element>
  </xs:sequence>
 </xs:complexType>
</xs:element>

I want validate the original XML using XSD and fill all default values:

<a>
 <b c="1"/>
 <b c="2"/>
</a>

How do I get it in Python? With validation there is no problem (e.g. XMLSchema). The problem are the default values.