Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > xs:element with two types (xs:string and xs:int)

Reply
Thread Tools

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

 
 
Adam Retter
Guest
Posts: n/a
 
      06-09-2005
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.
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      06-09-2005


Adam Retter wrote:

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

--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
C. M. Sperberg-McQueen
Guest
Posts: n/a
 
      06-10-2005
Martin Honnen <(E-Mail Removed)> writes:

> Adam Retter wrote:
>
> > 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.


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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Argument type of function and safe types and types, arguments canhandle safely ittium C++ 4 12-09-2011 11:05 AM
How to compare two SOAP Envelope or two Document or two XML files GenxLogic Java 3 12-06-2006 08:41 PM
Questions about memory structure of value types and reference types Sam Kong Javascript 12 10-17-2006 07:26 PM
Where are ref types that are members of value types stored? Sathyaish ASP .Net 2 05-22-2005 07:32 PM
Disparity between XML Schema types and .Net CLS types MikeL ASP .Net Web Services 2 02-22-2005 06:08 AM



Advertisments