473,405 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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

Hi NG!

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

<xsd:element name="BsqCallInfo">
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:any processContents="lax"/>
</xsd:choice>
<xsd:attribute name="Name" type="xsd:string" />
<xsd:attribute name="Description" type="xsd:string" />
</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 1781


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

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

<xsd:element name="BsqCallInfo">
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:any processContents="lax"/>
</xsd:choice>
<xsd:attribute name="Name" type="xsd:string" />
<xsd:attribute name="Description" type="xsd:string" />
</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
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...
8
by: MENTAT | last post by:
Hi Guys, Newbie question here. Part of my xml looks like this. <node> <description/> <config/> <log/> <transition/> <node>
4
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...
5
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...
3
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...
6
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...
7
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...
10
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: ...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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...
0
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...
0
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,...

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.