开发者

Does XSD allow simpleContent and complexContent at the same time?

I want to write an xsd for the xmlrpc spec (and generate java classes out of it using jaxb). The xmlrpc spec allows values like:

<value><int>123</int></value>
<value><boolean>1</boolean></value>

But at the same time it requires:

If no type is indicated, the type is string.

Which means i could receive something like this:

<value>test123</value>

which is equivalent to

<value><string>te开发者_如何学Pythonst123</string></value>

Is there a way to define this in an xsd.


Yes, set a mixed content model on value:

<xs:complexType name="valuetype" mixed="true">
  <xs:sequence>
    <xs:element name="int" type="xs:int"/>
    <xs:element name="boolean" type="xs:boolean"/>
    ...
  </xs:sequence>
</xs:complexType>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜