Hi,
Say I have a schema which defines an element as follows:

    <xsd:element name="Widget" type="tns:WidgetType" />
    
    <xsd:complexType name="WidgetType">
      <xsd:sequence>

        <xsd:element name="Name" type="xsd:normalizedString" maxOccurs="1"
minOccurs="1" />
        <xsd:element name="Description" type="xsd:normalizedString"
default="Unknown" maxOccurs="1" minOccurs="0" />

      </xsd:sequence>
    </xsd:complexType>

I'm parsing (DOM parser) an XML file that has been validated against this
schema using Xerces-C++. If the `Description` element is present, I know how
to read it by iterating through all the child elements of the `DOMElement`
for a given `Widget` and using `DOMElement::getTextContent()` upon finding
the `Description` element.

But, if a particular `Widget` element does not have a `Description` child
element (which is allowed by the schema), how can I fetch the default value
(`Unknown`) from the schema?

Thanks for your responses,
Ashish
-- 
View this message in context: 
http://old.nabble.com/Get-default-value-for-element-from-schema-using-xerces-%28C%2B%2B%29-tp29169204p29169204.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.

Reply via email to