我从客户那里得到了以下XSD位.它是传统架构的一部分,涵盖了数十个文件.
<xs:element name="stateProvinceName">
<xs:complexType mixed="true">
<xs:attributeGroup ref="xml:attlist.global-attributes"/>
</xs:complexType>
</xs:element>
Run Code Online (Sandbox Code Playgroud)
我想弄清楚他们真正想要的是什么.没有子元素,那么'xs:mixed'的含义是什么?它应该是简单的内容,还是没有内容?
我告诉他们应该使用更多的标准结构,例如
<xs:element name="stateProvinceName">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attributeGroup ref="xml:attlist.global-attributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
Run Code Online (Sandbox Code Playgroud)
但他们不确定这意味着什么.两种模式都接受
<stateProvinceName ID="345643">California</stateProvinceName>
Run Code Online (Sandbox Code Playgroud)
和
<stateProvinceName ID="345643"/>
Run Code Online (Sandbox Code Playgroud)