I have the following xml, which I'd like to accept:
<Movies>
<Title>
<Platform>Hulu</Platform>
<PlatformID>500219855</PlatformID>
<Type>Movie</Type>
</Title>
<Title>
<Type>Movie</Type>
<Platform>Hulu</Platform>
<PlatformID>50019855</PlatformID>
<Platform>ITunes</Platform>
</Title>
</Movies>
I am currently using an xs:sequence
, but that restricts ordering. I also tried using an xs:all
instead, but that only allows a maxOccurrence
of 0 or 1, so wouldn't work in the above case where I have 2 Platform values. How would I accomlish the above with an xsd sceme?
答案 0 :(得分:1)
您是否尝试过使用<xsd:choice maxOccurs="unbounded"></xsd:choice>
关键是将xs:choice与maxOccurs =&#34;无界&#34;结合起来。如果您只使用xs:all,则允许其中一个为句点。
虽然xs:any会起作用,但它不会限制您对逐项列出的四个元素的选择。它将允许任何东西,这几乎违背了模式的目的。