x y
x y

Reputation: 1029

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

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?

Upvotes: 7

Views: 4464

Answers (1)

kjhughes
kjhughes

Reputation: 111491

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.

Upvotes: 7

Related Questions