XML Schema:xsd:attribute 的默认类型是什么? [英] XML Schema: what's the default type of an xsd:attribute?

查看:18
本文介绍了XML Schema:xsd:attribute 的默认类型是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In EBUCore schema (http://en.wikipedia.org/wiki/Metadata_standards) there is an attribute named 'version' defined as

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

如您所见,没有为它定义类型",我想知道它的默认类型是什么 - anyTypeanySimpleTypestring, float, double, ...

As you see, there is no 'type' defined for it and I wonder, what's the default type for it - anyType, anySimpleType, string, float, double, ...

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

W3C spec (http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#section-Built-in-Simple-Type-Definition) is a bit hard to get through:

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

The ·simple ur-type definition· is considered to have an unconstrained lexical space, and a value space consisting of the union of the value spaces of all the built-in primitive datatypes and the set of all lists of all members of the value spaces of all the built-in primitive datatypes.

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

So, maybe someone can tell me, which type to map this attribute to?

推荐答案

属性默认类型

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

Attribute Default Type

The type of XML attributes in XSD defaults to xsd:anySimpleType.

这是在哪里说的?

3.2.2 属性声明架构组件的 XML 表示

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

The simple type definition corresponding to the element information item in the [children], if present, otherwise the simple type definition ·resolved· to by the ·actual value· of the type [attribute], if present, otherwise the ·simple ur-type definition·.

然后,你可以找到simple ur-type definitionxsd:anySimpleType之间的联系这里:

Then, you can find the connection between simple ur-type definition and xsd:anySimpleType here:

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

[Definition:] The simple ur-type definition is a special restriction of the ur-type definition whose name is anySimpleType in the XML Schema namespace. anySimpleType can be considered as the ·base type· of all ·primitive· datatypes.

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

Yep, one would have hoped it'd have been easier to determine.

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

The type of XML elements in XSD defaults to ur-anytype.

这篇关于XML Schema:xsd:attribute 的默认类型是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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