【发布时间】:2014-09-30 17:10:15
【问题描述】:
也许我的词汇有些错误:
我想创建一个 xsd,它为元素定义了许多“自定义类型”之一。
我的 xml 应该具有始终相同的“someInfo”的根,然后一个元素是一种
CustomTypeA 或 CustomTypeB。
XML 应该如下所示:
<xml>
<someInfo>whatever is important</someInfo>
<info type="CustomTypeA">
<CustomTypeA-1>F1</CustomTypeA-1>
<CustomTypeA-2>F2</CustomTypeA-2>
</info>
</xml>
或者在其他情况下,如果是其他 CustomType,则 info 应该是:
<xml>
<someInfo>whatever is important in an other case</someInfo>
<info type="CustomTypeB">
<CustomTypeB-1 attr1="someAttribute">F1</CustomTypeB-1>
</info>
</xml>
【问题讨论】:
标签: xml xsd restriction