[xsd-users] reading simple_type

Nick Hunter nickhunteur at gmail.com
Tue Sep 7 10:51:09 EDT 2010


Hi,

I have generated tree bindings for the following schema fragment:

    <xsd:element name="Feature">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="Attr" minOccurs="0" maxOccurs="unbounded"
/>
                <xsd:element ref="Plugin" minOccurs="0"
maxOccurs="unbounded" />
            </xsd:sequence>
            <xsd:attribute name="StartUp" use="required" />
            <xsd:attribute name="Id" type="TagType" use="required" />
            <xsd:attribute name="Alias" use="required" />
            <xsd:attribute name="Aggregating" type="TagType" use="optional"
/>
        </xsd:complexType>
    </xsd:element>
    <xsd:simpleType name="TagType">
        <xsd:restriction base="xsd:positiveInteger"></xsd:restriction>
    </xsd:simpleType>

I wish to use the generated code to parse and print out the values saved
from the following xml fragment:

    <Feature StartUp="RenderingRootFeature" Id="1"
Alias="RenderingRootFeature"/>

The " <xsd:attribute name="StartUp" use="required" /> " schema definition
has not been declared with a 'type' and so the StartUp member of the Feature
class is an ::xml_schema::simple_type in the tree. The same can be seen for
the Alias attribute.

The problem I have run into is how to read the value "RenderingRootFeature"
from the StartUp and Alias attributes. Is there a way to read a std::string
from the ::xml_schema::simple_type?

Thanks,
Nick


More information about the xsd-users mailing list