Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSD: Any valid XML in one node - different parser results

Reply
Thread Tools

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

 
 
mkremser@gmail.com
Guest
Posts: n/a
 
      01-18-2005
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

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      01-18-2005


http://www.velocityreviews.com/forums/(E-Mail Removed) 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/
 
Reply With Quote
 
 
 
 
Priscilla Walmsley
Guest
Posts: n/a
 
      01-18-2005
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!
 
Reply With Quote
 
Michael Kremser
Guest
Posts: n/a
 
      01-19-2005
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.
 
Reply With Quote
 
Michael Kremser
Guest
Posts: n/a
 
      01-19-2005
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.
 
Reply With Quote
 
Stan Kitsis [MSFT]
Guest
Posts: n/a
 
      01-20-2005
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" <(E-Mail Removed)> wrote in message
news:41edfb02$(E-Mail Removed)...
> ....................
> 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.
>



 
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
xsl variable $node/text() but $node can non-node-set help! Tjerk Wolterink XML 2 08-24-2006 03:28 AM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
How to set the node indent property between the parent node and the leaf node viveknatani@gmail.com ASP .Net 0 02-13-2006 07:11 PM
XML-Parser to XML-Parser communication (encoding issues?) arne Perl Misc 0 09-13-2005 12:53 PM
XSL HOWDOI use attribute of current node to select a different node? CB XML 1 10-02-2003 02:37 PM



Advertisments