xs:没有元素混合的含义是什么? [英] What is the meaning of xs:mixed without elements?

查看:123
本文介绍了xs:没有元素混合的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从客户那里得到了以下XSD.它是跨越数十个文件的旧式架构的一部分.

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

<xs:element name="stateProvinceName">
  <xs:complexType mixed="true">
    <xs:attributeGroup ref="xml:attlist.global-attributes"/>
  </xs:complexType>
</xs:element>

我试图弄清楚他们真正想要的是什么.没有子元素,那么"xs:mixed"的含义是什么?应该是simpleContent还是没有内容?

I'm trying to figure out what they actually want. There are no sub-elements, so what is the meaning of this 'xs:mixed'? is it supposed to be simpleContent, or no content?

我告诉他们,他们应该使用更多标准结构,例如

I told them that they should use more standard construct, e.g.

<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>

但是他们不确定这是否意味着同一件事.两种模式都接受

But they are not sure it means the same thing. Both schemas accept

<stateProvinceName ID="345643">California</stateProvinceName>

<stateProvinceName ID="345643"/>

推荐答案

这两种类型在表面上可能是等效的,但它们的可扩展性不同.使用xs:string的简单内容类型可以通过例如使用正则表达式约束字符串来优化类型,而使用不包含元素的混合复杂内容类型可以通过向模型中添加元素来进行优化.

The two types might be equivalent on the surface, but their extensibility is different. Using a simple content type of xs:string allows refinement of the type by constraining the string for example with a regular expression, while using a mixed complex content type with no elements allows refinement by adding elements to the model.

这篇关于xs:没有元素混合的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆