What is the meaning of xs:mixed without elements?

前端 未结 3 1351
盖世英雄少女心
盖世英雄少女心 2021-01-21 12:57

I got the following XSD bit from a customer. It is part of a legacy schema that spans over dozens of files.


  

        
3条回答
  •  心在旅途
    2021-01-21 13:40

    The use of mixed with an empty content model is perfectly standard. If you don't like their content model, you'll need a different argument.

    In general, mixed="true" means that character content is allowed among the child elements in a given complex type; in this case, since there are no child elements in the content model, the only legal content of the parent element will be character data, comments, and processing instructions. The upshot will be that the element declaration accepts the same set of elements as it would if the element were typed using a complex type with simple content declared as an extension of xs:string.

    The choice between mixed-content and string is a design decision. In general, mixed content is better for natural-language prose, even if the initial design of an element does not foresee the need for sub-elements. In general, xs:string is easier to use if as the basis for restrictions of the set of expected values. (If you want to constrain the stateProvinceName to accept only the codes defined by particular postal services, xs:string is a better basis for your work than mixed content.)

提交回复
热议问题