xs:element with two types (xs:string and xs:int)

A

Adam Retter

I would like to have an element defined in my XML Schema, that can hold
either an xs:string or xs:int value. Is this possible?

e.g. something like -

<xs:element name="service">
<xs:simpleType>
<xs:restriction base="xs:string"/>
<xs:restriction base="xs:int"/>
</xs:simpleType>
</xs:element>


Thanks

--
Adam Retter
Devon Portal Technician

Devon Portal Project
Devon e-Partnership
County Hall
Exeter
Devon, UK.
 
M

Martin Honnen

Adam said:
I would like to have an element defined in my XML Schema, that can hold
either an xs:string or xs:int value. Is this possible?

You can build a union of simple types e.g.
<xs:union>
however I am not sure what sense that makes for xs:string and xs:int as
obviously xs:string contains any xs:int anyway.
 
C

C. M. Sperberg-McQueen

Martin Honnen said:
You can build a union of simple types e.g.
<xs:union>
however I am not sure what sense that makes for xs:string and xs:int
as obviously xs:string contains any xs:int anyway.

The lexical space of xsd:string contains the lexical space
of xsd:int, but the value spaces are disjoint, and it
can matter to an application which uses the type annotations
provided by schema processing.

-C. M. Sperberg-McQueen
World Wide Web Consortium
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,247
Members
46,844
Latest member
JudyGvh32

Latest Threads

Top