Is it possible to generate an xml for an xsd simple type?

269 views Asked by At

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?

1

There are 1 answers

4
Stefan Gehrig On BEST ANSWER

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>