Question

By XML Schema datatype, I mean any datatype that would be found in the schema for schemas.

Does anyone know of such a type? [That is, a type which accepts the names of the XSD 1.0 datatypes, and nothing else.]

Edit: Example:

XML:

<table name="my_name">
    <column name="col1" type="BOOLEAN">
    <column name="col2" type="INT"/>
</table>

So the goal is the validate the type attribute for element column. The type attribute would ideally validate only valid XML datatypes, such as int, boolean, or string.

Was it helpful?

Solution

I think you haven't expressed yourself clearly: I suspect that what you want is a type whose value space is the set of names of built-in simple types.

The names of built-in simple types are all QNames, so your type should be a restriction of xs:QName, restricted with an enumeration to constrain it to the built-in types:

<xs:simpleType name="builtInTypeName">
  <xs:restriction base="xs:QName">
    <xs:enumeration value="xs:decimal"/>
    <xs:enumeration value="xs:boolean"/>
    etc
  </xs:restriction>
</xs:simpleType>

At least, I think that's what you want - but I'm guessing. The fact that you haven't used the XSD type names like xs:boolean and xs:integer, but your own type names BOOLEAN and INT, makes me suspect I haven't quite grasped what you are after.

OTHER TIPS

You may be looking for xs:anyType, or maybe xs:anySimpleType.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top