开发者

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

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?


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜