473,779 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

simplecontent in a choice (xmlschema)

Hej,

I want to achieve the following situation:
<mytag>foo</mytag>

or:
<mytag><other ref="bar"/></mytag>

So mytag contains either text (simplecontent) or the other element.

How do I specify this in xmlschema?? I'm not able to add a
simplecontent element into a choice element.

Thanks in advance,
Thys
Jun 27 '08 #1
1 1360
Thijs wrote:
I want to achieve the following situation:
<mytag>foo</mytag>

or:
<mytag><other ref="bar"/></mytag>

So mytag contains either text (simplecontent) or the other element.

How do I specify this in xmlschema?? I'm not able to add a
simplecontent element into a choice element.
I think the only way is by allowing mixed content, see
http://www.w3.org/TR/xmlschema-0/#mixedContent
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 27 '08 #2

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

Similar topics

3
4564
by: Kimmo J?rvikangas | last post by:
Dear XML (Schema) experts, As an example I have the following schema: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="ROOT_ELEMENT"> <xs:complexType> <xs:choice>
3
1961
by: David Norman | last post by:
How can I create an xml schema where both of the following documents are valid? <theElement> <child>some text</child> </theElement> and <theElement>1234</theElement>
1
1377
by: Mario | last post by:
Hi; I try to limit the selection of elements to exactly one. I have to do it by using elements, attributes are no alternativ. If I use the configuration shown below, it is also possible to select no element. If I set minOccurs to 1 at both elements, I have to select both. How I can can define that just one and no more than one element are allowed? Thx for your help!
4
8999
by: Dennis Vroegop | last post by:
Hi there! I have the following XSD (Well, this is not the real one, but the concept is the same....) <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:complexType name="DataItemType"> <xs:choice>
2
2373
by: Matthew | last post by:
I have implemented the xmlSchemaCollection object to cache commonly used schemas, as follows: =============================================================================== public void SchemaValidate(XmlDocument xmlDoc, string schemaURI, string urnNamespace) {
3
1591
by: SideByEach | last post by:
Check out the sample XML below. Sample XML: <xs:element name="Image"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="Type" type="xs:string" use="required"/> <xs:attribute name="Name" type="xs:string" use="required"/> </xs:extension>
2
1363
by: Eric D | last post by:
Hi, is such a complex type valid? <xsd:complexType name="EthnicityCodeType"> <xsd:simpleContent> <xsd:extension base="nibrs:EthnicityCodeType"> <xsd:attributeGroup ref="j:SuperTypeMetadata"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> Thanks for your answers.
3
3854
by: Kai Schlamp | last post by:
Hello! In my schema I have the following: <xs:complexType name="textareaType"> <xs:simpleContent> <xs:restriction base="xs:string"> <xs:attribute ref="label" use="required" /> </xs:restriction> </xs:simpleContent>
0
2841
by: Peter Larsen | last post by:
Is this really a valid schema design? <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="root"> <xs:complexType> <xs:sequence> <xs:choice> <xs:element name="e1" minOccurs="0" />
0
9633
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10305
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10137
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6724
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2867
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.