473,950 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSD: Any valid XML in one node - different parser results

Hi NG!

In a XSD, we (try to) specify that a node ("BsqCallInf o") has two
attributes and can have any nodes as its children:

<xsd:element name="BsqCallIn fo">
<xsd:complexTyp e>
<xsd:choice minOccurs="0" maxOccurs="unbo unded">
<xsd:any processContents ="lax"/>
</xsd:choice>
<xsd:attribut e name="Name" type="xsd:strin g" />
<xsd:attribut e name="Descripti on" type="xsd:strin g" />
</xsd:complexType >
</xsd:element>

Now we have the problem that different parsers handle it differently
and we do not have a clue, which one behaves correctly.

Some parsers claim that

<BsqCallInfo>
<SomeThing></SomeThing>
</BsqCallInfo>

is wrong because "SomeThing" is not part of the schema, others accept
it.

So, what is right, what is wrong?

Best regards,

Michael

Jul 20 '05 #1
5 1814


mk******@gmail. com wrote:

In a XSD, we (try to) specify that a node ("BsqCallInf o") has two
attributes and can have any nodes as its children:

<xsd:element name="BsqCallIn fo">
<xsd:complexTyp e>
<xsd:choice minOccurs="0" maxOccurs="unbo unded">
<xsd:any processContents ="lax"/>
</xsd:choice>
<xsd:attribut e name="Name" type="xsd:strin g" />
<xsd:attribut e name="Descripti on" type="xsd:strin g" />
</xsd:complexType >
</xsd:element>

Now we have the problem that different parsers handle it differently
and we do not have a clue, which one behaves correctly.

Some parsers claim that

<BsqCallInfo>
<SomeThing></SomeThing>
</BsqCallInfo>

is wrong because "SomeThing" is not part of the schema, others accept
it.


Which parsers have you tried, which say the snippet is valid, which say
it is not?
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2
Hi,

It is valid for SomeThing to appear there, even if it is not declared.

When you specify processContents ="lax", it means that it looks for
declarations for the elements like SomeThing but if it doesn't find them
it doesn't raise an error. (If it does find them it validates them.)

So, the parsers should be accepting that document. What parser does not
accept it?

Hope that helps,
Priscilla

----------------------------------
Priscilla Walmsley
Author, Definitive XML Schema
http://www.datypic.com
----------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3
Hi Priscilla,

Thanks for your answer!

Priscilla Walmsley schrieb:
It is valid for SomeThing to appear there, even if it is not declared.

When you specify processContents ="lax", it means that it looks for
declarations for the elements like SomeThing but if it doesn't find them
it doesn't raise an error. (If it does find them it validates them.)
That's exactly how I interpreted the documentation!
So, the parsers should be accepting that document. What parser does not
accept it?
MS XML 4 has accepted it, but the .net FX classes behave differently.
Here is an example what .net 2.0.41115 "thinks":

http://www.mkcs.at/temp/pub/w2k3%5Fv...alidator%2Ejpg

A colleague found a Java XSD validator in the Internet, which says the
XML is correct. So we were confused that "older" parsers accepted it,
but "newer" one (at least, those from Microsoft) say there is an error.

I'll post this as a bug, because also VS.net 2005 Beta 2 thinks the XML
is not valid though it is as we know now.
Hope that helps,
Yes, it did. :-)
Priscilla


Thanks again and best regards,

Michael

--
http://www.mkcs.at/
The specified e-mail-address is valid and will be read.
Jul 20 '05 #4
Hi Martin,

Thanks for your reply!
Which parsers have you tried, which say the snippet is valid, which say
it is not?


Please see the answer to Priscilla's Posting.

Best regards,

Michael

--
http://www.mkcs.at/
The specified e-mail-address is valid and will be read.
Jul 20 '05 #5
Hi Michael,

VS 2005 Beta 2 does not exist yet. So I'm not sure which version you are
using - must be beta 1. Anyway, I just tried it with the build I have on my
machine and your XML validates just fine. So even if there is a problem
with earlier versions of VS 2005, it looks like it's should be fixed in
beta2.

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
"Michael Kremser" <mk************ @yahoo.de> wrote in message
news:41******** @e-post.inode.at.. .
............... .....
I'll post this as a bug, because also VS.net 2005 Beta 2 thinks the XML is
not valid though it is as we know now.

Jul 20 '05 #6

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

Similar topics

0
1677
by: Yona | last post by:
Im trying to validate an xml file using the xercesDomParser, but it seems like it doesnt validate the xml file. I get an error only if the schema isnt valid. the code is: DOMTreeErrorReporter *errReporter = new DOMTreeErrorReporter(); parser->setErrorHandler(errReporter); parser->setDoSchema(TRUE); parser->setDoNamespaces(TRUE);
8
2360
by: MENTAT | last post by:
Hi Guys, Newbie question here. Part of my xml looks like this. <node> <description/> <config/> <log/> <transition/> <node>
4
2414
by: Jon Poploskie | last post by:
Hello, I have an xsd file that I'm trying to use to validate some xml against. I'm hoping this is a simple problem, but I just don't see it. I get the error "The 'role' element is not declared." when trying to validate this xml: <users> <user id="jon" pwd="pass"> <roles><role>Admin</role></roles> </user>
5
17661
by: Paw Pedersen | last post by:
Is it possible to load a XSD and loop throw the nodes and attributes that you whant filled out, and then generate a XML instance with the trees and data that you have filled data in? And how do you do that? Regards Paw
3
6066
by: Shailendra Batham | last post by:
hi guys I need your suggestions / opinion for doing this the right way. I have a XML and a Schema for the same What I want is when its validated against the schema, it should give custom errors saying what happened and where...... is it possible to do that ? for eg. if the Attribute is missing or invalid in the following element <Watch ID="999d999">
6
4258
by: Mark Jerde | last post by:
We have developed about 80 XML documents, each probably 150 lines long, that are all supposed to conform to a schema. My understanding is the way to show that an XML document conforms to a schema is to include a reference to the XSD in the XML document, and check that it is valid. Some other members of the project team don't want to include a reference to the XSD in the XML documents, citing possible differences in parsers. Is my...
7
10298
by: christian.eickhoff | last post by:
Hi Everyone, I am currently implementing an XercesDOMParser to parse an XML file and to validate this file against its XSD Schema file which are both located on my local HD drive. For this purpose I set the corresponding XercesDOMParser feature as shown in the upcoming subsection of my code. As far as I understand, the parsing process should throw an DOMException in case the XML file doesn't match the Schema file (e.g. Element...
10
8829
by: Simon Brooke | last post by:
The DOM API has included public Node importNode(Node,boolean) as a method of the Document interface for a long time. Does anything actually implement it? Xerces 2 is giving me: org.w3c.dom.DOMException: NOT_SUPPORTED_ERR: The implementation does not support the requested type of object or operation. at org.apache.xerces.dom.CoreDocumentImpl.importNode(Unknown Source) at org.apache.xerces.dom.CoreDocumentImpl.importNode(Unknown Source)
0
1087
by: Boris Kolpackov | last post by:
Hi, I am pleased to announce the availability of CodeSynthesis XSD 3.2.0. CodeSynthesis XSD is an open-source (GPL2 + proprietary license), cross- platform W3C XML Schema to C++ data binding compiler. Provided with a schema, it generates C++ classes that represent the given vocabulary as well as parsing and serialization code. You can then access the data stored in XML using types and functions that semantically correspond to your...
0
10171
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
11595
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...
1
11366
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
10703
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8268
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7443
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
4965
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
4549
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3558
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.