views:

34

answers:

1

Hi,

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"&gt;
    <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  A: 

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>
Stefan Gehrig
OK, and should I add this element definition within the xsd, or the xml, please?
Vinzz
The `element`-definition has to go into the schema (XSD).
Stefan Gehrig
Well, thanks. I've now to wonder why there isn't such a definition in my generated xsd.
Vinzz
Perhaps the type is simply used as the base-type for some other type. Sorry but I am not familiar with Corba IDL and its transformation into an XSD schema.
Stefan Gehrig