473,545 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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:simpleTyp e>
<xs:restricti on base="xs:string "/>
<xs:restricti on base="xs:int"/>
</xs:simpleType>
</xs:element>
Thanks

--
Adam Retter
Devon Portal Technician

Devon Portal Project
Devon e-Partnership
County Hall
Exeter
Devon, UK.
Jul 20 '05 #1
2 1536


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/
Jul 20 '05 #2
Martin Honnen <ma*******@yaho o.de> 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
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1148
by: Timo Nentwig | last post by:
Hi! I try to write a schema for: <f4t-config> <database> <jndi-url>foo</jndi-url> <fetch-size>100</fetch-size> <!-- these are the problem --> <query id="foo">bar</query>
1
1831
by: Alejandro Calbazana | last post by:
Hello, Should the XmlValidatingReader validating xml against an xsd serially (e.g. - does the XML have to be in the correct position in order for a document to be valid)? For example, I am trying to validate an xsd against a sample XML document and receive errors indicating that there is an invalid child node in my xml.
3
1792
by: MSSQLServerDeveloper | last post by:
I have a simple vb.net program that creates an xmlschema using the dataset method writexmlschema (see #1). It creates a file (see #2), but I would like a file that looks like #3 - #3 is DIFFERENT from #2 inthat it has a sql:relation, where #2 does not. Why is my code producing this when others produce #3? ==================== #1 - My Code...
2
7531
by: Json | last post by:
Ok, brand new to SQLXML 3.0 and its various issues. Heres what I'm trying to do: 1. I am trying to load xml data into an empty SQL table from my .NET console application. 2. This isn't a huge amount of data so I'm not interested in BulkXMLLoad (or whatever its called). 3. I have the xml and xml schema ready to go, with (I hope) the proper...
1
1300
by: ronchese | last post by:
Hello All. I need to complement some information in a xml file, using the Xml.XmlDocument object. This xml contains several <xs:element ....> nodes (is a saved dataset), and I need to write new nodes exactly in the same way the existant nodes. I tried naming the new node as "xs:element" or type the "element" in the namespaceURI, but it...
3
2408
by: nshala | last post by:
Hallo, I wrote a complex XSD-Schema for validating complex XML files. By validating xs:int elements XmlValidatingReader does not validate it correctly. My XSD looks like this: .... <xs:complexType name="Frage"> <xs:all> <xs:element name="Wann" type="xs:string" minOccurs="0"
1
1824
by: trialproduct2004 | last post by:
Hi all, I am having table in database with say name as '1company'. when i generate strongly typed dataset for this table in xsd file i am getting entry as below:- <xs:element name="_x0031_company" type="xs:string" minOccurs="0" /> Can anyone tell me why column name '1company' is written as "_x0031_company"?
4
6174
by: Bradley Plett | last post by:
It seems that the XSD tool supplied with VS2005 does not handle "xs:union". Am I doing something wrong? Is there a work-around? Here is a simple sample file: -------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"...
1
4044
by: executeinc | last post by:
Could you some help to define 1. An element with restriction on it's base type (xs:string), limiting maxlength 2. That element also needs two attributes defined on it. Simple restriction is easy: <xs:element name="kirk" minOccurs="0" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="2"/>
0
7502
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7434
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7692
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7791
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6026
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3491
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1045
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
744
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.