开发者

How does maxOccurs relate to multiple language (xml:lang) versions of the same element?

开发者 https://www.devze.com 2023-03-14 08:11 出处:网络
Does maxOccurs limit the number of language versions? What I mean is - does <xs:element ref=\"attachments\" minOccurs=\"0\" **maxOccurs=\"1\"**/>

Does maxOccurs limit the number of language versions?

What I mean is - does

<xs:element ref="attachments" minOccurs="0" **maxOccurs="1"**/>
开发者_开发技巧

(in XML schema), forbid:

<attachments>
   <audio>
      <sound url="http://bla.com/eng.mp3" xml:lang="eng"/>
      <sound url="http://bla.com/ger.mp3" xml:lang="ger"/>
   </audio>
[...]

And by the way, there's also "video" and "documents" sections (apart from "audio"), so I'm not sure how this schema (a real life example, not made up!) is actually supposed to work?

Just one attachment of each type? But multiple language versions OK?


There's nothing magic amount xml:lang as far as XSD is concerned; the same rules apply as if the attribute were called foobar.

Note that the maxOccurs you are showing us constrains the number of "attachments" elements within its parent element. It has no bearing on what appears inside an "attachments" element or inside an "audio" element.


It means that there will be at most one <attachments> element (could be less because of the minOccurs="0") at that particular point in the document. It does not constrain the content of the element; that would be done inside the definition of that element (or in its type).

0

精彩评论

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

关注公众号