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

Discussion in 'XML' started by mkremser@gmail.com, Jan 18, 2005.

  1. Guest

    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
    , Jan 18, 2005
    #1
    1. Advertising

  2. 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/
    Martin Honnen, Jan 18, 2005
    #2
    1. Advertising

  3. 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!
    Priscilla Walmsley, Jan 18, 2005
    #3
  4. 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_vsnet2005_xsd_validator.jpg

    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.
    Michael Kremser, Jan 19, 2005
    #4
  5. 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.
    Michael Kremser, Jan 19, 2005
    #5
  6. 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" <> wrote in message
    news:41edfb02$...
    > ....................
    > 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.
    >
    Stan Kitsis [MSFT], Jan 20, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,396
  2. CB
    Replies:
    1
    Views:
    585
    Johannes Koch
    Oct 2, 2003
  3. Peter Aberline

    xsd:any as a child of xsd:all

    Peter Aberline, Apr 5, 2004, in forum: XML
    Replies:
    0
    Views:
    770
    Peter Aberline
    Apr 5, 2004
  4. Tjerk Wolterink
    Replies:
    2
    Views:
    1,399
    Dimitre Novatchev
    Aug 24, 2006
  5. Erik Wasser
    Replies:
    5
    Views:
    428
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page