Question

I've got the following simple type coming from a Corba IDL translated to xsd:

<xs:simpleType name="fooType" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:restriction base="xs:string">
        <xs:enumeration value="bar" />
        <xs:enumeration value="baz" />
    </xs:restriction>
</xs:simpleType>

The problem I'm facing is how to create an xml file matching this xsd? I mean, I barely know how to do for complex types, but this simple type with enumeration puzzles me.

Any idea?

Was it helpful?

Solution

As this XSD-fragment only defines a custom simple type, what exactly do you want to know?

The given type defines a string that can either be bar or baz.

As the definition is only a type-definition, you'll have to use some kind of element-definition that actually uses the type, e.g.:

<xs:element name="foo" type="fooType"/>

This will allow the following tags in your XML:

<foo>bar</foo>
<foo>baz</foo>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top