praetorian20 wrote:

> 
> 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

Hi, I have almost same question, except that my XSD is using a lot of
namespaces. So thee is one element <layer> that is defined in different
namespaces to have different attributes.

I think we need an example how to handle xsd files.

<xsd:element name="a:layer" type="xsd:normalizedString" maxOccurs="1"
> minOccurs="1" />

<xsd:element name="b:layer" type="xsd:normalizedString" maxOccurs="1"
> minOccurs="1" />

<xsd:element name="c:layer" type="xsd:normalizedString" maxOccurs="1"
> minOccurs="1" />

????

thanks

Reply via email to