XML Schema: what's the default type of an xsd:attribute?

狂风中的少年 提交于 2020-01-09 11:38:09

问题


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>

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 spec (http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#section-Built-in-Simple-Type-Definition) is a bit hard to get through:

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?


回答1:


Attribute Default Type

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

Where's it say that?

3.2.2 XML Representation of Attribute Declaration Schema Components

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

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

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

Element Default Type

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



来源:https://stackoverflow.com/questions/29845983/xml-schema-whats-the-default-type-of-an-xsdattribute

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!