【问题标题】:XML Schema: what's the default type of an xsd:attribute?XML Schema:xsd:attribute 的默认类型是什么?
【发布时间】:2015-04-24 11:11:11
【问题描述】:

在 EBUCore 架构 (http://en.wikipedia.org/wiki/Metadata_standards) 中有一个名为“版本”的属性定义为

<attribute name="version" default="1.5">
  <annotation>
    <documentation> The version of the schema for e.g. OAI management.</documentation>
  </annotation>
</attribute>

如您所见,没有为它定义“类型”,我想知道它的默认类型是什么 - anyType, anySimpleType, string, float, double, ...

W3C 规范 (http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#section-Built-in-Simple-Type-Definition) 有点难以通过:

··简单的 ur-type 定义·被认为是无约束的 词法空间和由值的并集组成的值空间 所有内置原始数据类型的空间和所有的集合 所有内置原语的值空间的所有成员的列表 数据类型。

那么,也许有人可以告诉我,将此属性映射到哪种类型?

【问题讨论】:

    标签: xml xsd


    【解决方案1】:

    属性默认类型

    XSD 中XML 属性 的类型默认为xsd:anySimpleType

    这是在哪里说的?

    3.2.2 XML Representation of Attribute Declaration Schema Components

    元素对应的简单类型定义 [children] 中的信息项,如果存在,否则为简单 类型定义·解析·由类型的·实际值· [属性],如果存在,否则为·简单的 ur 类型定义·

    然后,你可以找到简单的ur-type定义xsd:anySimpleTypehere之间的联系:

    [Definition:] 简单的 ur-type 定义是一个特殊的限制 在 XML 中名称为 anySimpleType 的 ur-type 定义的 架构命名空间。 anySimpleType 可以被认为是·基类型· 所有·原始·数据类型。

    是的,人们希望它更容易确定。

    元素默认类型

    XSD 中XML 元素 的类型默认为ur-anytype

    【讨论】:

      猜你喜欢
      • 2014-07-28
      • 1970-01-01
      • 2010-12-06
      • 2014-09-30
      • 2012-11-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多