You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Peter A. Volchek" <Pe...@ti.com.od.ua> on 2002/08/15 18:52:24 UTC

XML Schema root element

I have noticed that Xerces does not validate the XML schema's root element.
In other words, it is possible to validate the following schema w/o errors

<xs:ANYNAME xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:element name="A" type="xs:string"/>
</xs:ANYNAME>

Is it bug or just missed item or even allowed situation?



Re: XML Schema root element

Posted by Khaled Noaman <kn...@ca.ibm.com>.
Peter,

Good catch. That's a bug. Would you please open a bugzilla bug for it?

Khaled

"Peter A. Volchek" wrote:

> David,I know it, thank you.But the fact is that Xerces' parser parses
> it and validates w/o error. That was the question. Regards, Peter
>
>      ----- Original Message -----
>      From: David Cleary
>      To: xerces-c-dev@xml.apache.org
>      Sent: Friday, August 16, 2002 4:26 PM
>      Subject: RE: XML Schema root element
>       Your schema isn't valid as it doesn't start with the schema
>      element.David Cleary
>
>           -----Original Message-----
>           From: Peter A. Volchek
>           [mailto:PeterV@ti.com.od.ua]
>           Sent: Friday, August 16, 2002 6:22 AM
>           To: xerces-c-dev@xml.apache.org
>           Subject: Re: XML Schema root element
>
>           Tinny, I have attached the sample files. Run a.bat
>           to process Here is the a.bat contentDOMPrint.exe
>           -v=always -n -s -f a.xml As you may see the
>           validation is set to always. Since it parses and
>           validates the xml successfully, that may be the
>           problem with the DOMPrint sample.But I think the
>           problem is somewhere in the code, since I got that
>           situation in my project's tests Peter
>
>                ----- Original Message -----
>                From: Tinny Ng
>                To: xerces-c-dev@xml.apache.org
>                Sent: Thursday, August 15, 2002 9:39 PM
>                Subject: Re: XML Schema root element
>                 Peter, Is it you have validation schema
>                set to Val_Auto?  If so, change it to
>                Val_Always, then you should see
>                validation error of the root
>                element. How Val_Auto works is:1. When
>                the parser enters the xs:ANYNAME, the
>                validation flag is off.2. Then a schema
>                is encountered, the validation flag is
>                then set to on3. So when the parser
>                entering the xs:element, the validation
>                flag is on Such validation flag works
>                like a stack, and is being popped and
>                pushed when entering and leaving the
>                element.   Since the validation flag was
>                off when entering xs:ANYNAME, thus the
>                root is not validated but xs:element
>                is. Tinny
>
>                     ----- Original Message -----
>                     From: Peter A. Volchek
>                     To: Xerces-Dev
>                     Sent: Thursday, August 15,
>                     2002 12:52 PM
>                     Subject: XML Schema root
>                     element
>                      I have noticed that Xerces
>                     does not validate the XML
>                     schema's root element.In other
>                     words, it is possible to
>                     validate the following schema
>                     w/o errors <xs:ANYNAME
>                     xmlns:xs="http://www.w3.org/2001/XMLSchema">
>
>                      <xs:element name="A"
>                     type="xs:string"/>
>                     </xs:ANYNAME> Is it bug or
>                     just missed item or even
>                     allowed situation?
>

Re: XML Schema root element

Posted by "Peter A. Volchek" <Pe...@ti.com.od.ua>.
David,
I know it, thank you.
But the fact is that Xerces' parser parses it and validates w/o error. That was the question.

Regards, Peter
  ----- Original Message ----- 
  From: David Cleary 
  To: xerces-c-dev@xml.apache.org 
  Sent: Friday, August 16, 2002 4:26 PM
  Subject: RE: XML Schema root element


  Your schema isn't valid as it doesn't start with the schema element.

  David Cleary

    -----Original Message-----
    From: Peter A. Volchek [mailto:PeterV@ti.com.od.ua]
    Sent: Friday, August 16, 2002 6:22 AM
    To: xerces-c-dev@xml.apache.org
    Subject: Re: XML Schema root element


    Tinny,

    I have attached the sample files. Run a.bat to process

    Here is the a.bat content
    DOMPrint.exe -v=always -n -s -f a.xml

    As you may see the validation is set to always. Since it parses and validates the xml successfully, that may be the problem with the DOMPrint sample.
    But I think the problem is somewhere in the code, since I got that situation in my project's tests

    Peter
      ----- Original Message ----- 
      From: Tinny Ng 
      To: xerces-c-dev@xml.apache.org 
      Sent: Thursday, August 15, 2002 9:39 PM
      Subject: Re: XML Schema root element


      Peter,

      Is it you have validation schema set to Val_Auto?  If so, change it to Val_Always, then you should see validation error of the root element.

      How Val_Auto works is:
      1. When the parser enters the xs:ANYNAME, the validation flag is off.  
      2. Then a schema is encountered, the validation flag is then set to on 
      3. So when the parser entering the xs:element, the validation flag is on

      Such validation flag works like a stack, and is being popped and pushed when entering and leaving the element.   Since the validation flag was off when entering xs:ANYNAME, thus the root is not validated but xs:element is.   

      Tinny
        ----- Original Message ----- 
        From: Peter A. Volchek 
        To: Xerces-Dev 
        Sent: Thursday, August 15, 2002 12:52 PM
        Subject: XML Schema root element


        I have noticed that Xerces does not validate the XML schema's root element.
        In other words, it is possible to validate the following schema w/o errors

        <xs:ANYNAME xmlns:xs="http://www.w3.org/2001/XMLSchema">
         <xs:element name="A" type="xs:string"/>
        </xs:ANYNAME>

        Is it bug or just missed item or even allowed situation?

         

RE: XML Schema root element

Posted by David Cleary <da...@progress.com>.
Your schema isn't valid as it doesn't start with the schema element.

David Cleary

  -----Original Message-----
  From: Peter A. Volchek [mailto:PeterV@ti.com.od.ua]
  Sent: Friday, August 16, 2002 6:22 AM
  To: xerces-c-dev@xml.apache.org
  Subject: Re: XML Schema root element


  Tinny,

  I have attached the sample files. Run a.bat to process

  Here is the a.bat content
  DOMPrint.exe -v=always -n -s -f a.xml

  As you may see the validation is set to always. Since it parses and
validates the xml successfully, that may be the problem with the DOMPrint
sample.
  But I think the problem is somewhere in the code, since I got that
situation in my project's tests

  Peter
    ----- Original Message -----
    From: Tinny Ng
    To: xerces-c-dev@xml.apache.org
    Sent: Thursday, August 15, 2002 9:39 PM
    Subject: Re: XML Schema root element


    Peter,

    Is it you have validation schema set to Val_Auto?  If so, change it to
Val_Always, then you should see validation error of the root element.

    How Val_Auto works is:
    1. When the parser enters the xs:ANYNAME, the validation flag is off.
    2. Then a schema is encountered, the validation flag is then set to on
    3. So when the parser entering the xs:element, the validation flag is on

    Such validation flag works like a stack, and is being popped and pushed
when entering and leaving the element.   Since the validation flag was off
when entering xs:ANYNAME, thus the root is not validated but xs:element is.

    Tinny
      ----- Original Message -----
      From: Peter A. Volchek
      To: Xerces-Dev
      Sent: Thursday, August 15, 2002 12:52 PM
      Subject: XML Schema root element


      I have noticed that Xerces does not validate the XML schema's root
element.
      In other words, it is possible to validate the following schema w/o
errors

      <xs:ANYNAME xmlns:xs="http://www.w3.org/2001/XMLSchema">
       <xs:element name="A" type="xs:string"/>
      </xs:ANYNAME>

      Is it bug or just missed item or even allowed situation?



Re: XML Schema root element

Posted by "Peter A. Volchek" <Pe...@ti.com.od.ua>.
Tinny,

I have attached the sample files. Run a.bat to process

Here is the a.bat content
DOMPrint.exe -v=always -n -s -f a.xml

As you may see the validation is set to always. Since it parses and validates the xml successfully, that may be the problem with the DOMPrint sample.
But I think the problem is somewhere in the code, since I got that situation in my project's tests

Peter
  ----- Original Message ----- 
  From: Tinny Ng 
  To: xerces-c-dev@xml.apache.org 
  Sent: Thursday, August 15, 2002 9:39 PM
  Subject: Re: XML Schema root element


  Peter,

  Is it you have validation schema set to Val_Auto?  If so, change it to Val_Always, then you should see validation error of the root element.

  How Val_Auto works is:
  1. When the parser enters the xs:ANYNAME, the validation flag is off.  
  2. Then a schema is encountered, the validation flag is then set to on 
  3. So when the parser entering the xs:element, the validation flag is on

  Such validation flag works like a stack, and is being popped and pushed when entering and leaving the element.   Since the validation flag was off when entering xs:ANYNAME, thus the root is not validated but xs:element is.   

  Tinny
    ----- Original Message ----- 
    From: Peter A. Volchek 
    To: Xerces-Dev 
    Sent: Thursday, August 15, 2002 12:52 PM
    Subject: XML Schema root element


    I have noticed that Xerces does not validate the XML schema's root element.
    In other words, it is possible to validate the following schema w/o errors

    <xs:ANYNAME xmlns:xs="http://www.w3.org/2001/XMLSchema">
     <xs:element name="A" type="xs:string"/>
    </xs:ANYNAME>

    Is it bug or just missed item or even allowed situation?

     

Re: XML Schema root element

Posted by Khaled Noaman <kn...@ca.ibm.com>.
Peter,

I agree with you that the xsd element 'schema' should be checked as an
essential construction of XMLSchema. I think Tinny was refering to the
validation of the root element in an XML document (.xml) that references
an XMLSchema grammar.

Khaled

"Peter A. Volchek" wrote:

> Tinny, Let me disagree with you. My opinion is that root XMLSchema
> element 'schema' should be checked not depending on validation state
> (auto, always or never) like an essential construction of
> XMLSchema. Thoughts? Peter.
>
>      ----- Original Message -----
>      From: Tinny Ng
>      To: xerces-c-dev@xml.apache.org
>      Sent: Thursday, August 15, 2002 9:39 PM
>      Subject: Re: XML Schema root element
>       Peter, Is it you have validation schema set to Val_Auto?
>      If so, change it to Val_Always, then you should see
>      validation error of the root element. How Val_Auto works
>      is:1. When the parser enters the xs:ANYNAME, the validation
>      flag is off.2. Then a schema is encountered, the validation
>      flag is then set to on3. So when the parser entering the
>      xs:element, the validation flag is on Such validation flag
>      works like a stack, and is being popped and pushed when
>      entering and leaving the element.   Since the validation
>      flag was off when entering xs:ANYNAME, thus the root is not
>      validated but xs:element is. Tinny
>
>           ----- Original Message -----
>           From: Peter A. Volchek
>           To: Xerces-Dev
>           Sent: Thursday, August 15, 2002 12:52 PM
>           Subject: XML Schema root element
>            I have noticed that Xerces does not validate the
>           XML schema's root element.In other words, it is
>           possible to validate the following schema w/o
>           errors <xs:ANYNAME
>           xmlns:xs="http://www.w3.org/2001/XMLSchema">
>            <xs:element name="A" type="xs:string"/>
>           </xs:ANYNAME> Is it bug or just missed item or
>           even allowed situation?
>

Re: XML Schema root element

Posted by "Peter A. Volchek" <Pe...@ti.com.od.ua>.
Tinny,

Let me disagree with you. My opinion is that root XMLSchema element 'schema' should be checked not depending on validation state (auto, always or never) like an essential construction of XMLSchema.

Thoughts?

Peter.

  ----- Original Message ----- 
  From: Tinny Ng 
  To: xerces-c-dev@xml.apache.org 
  Sent: Thursday, August 15, 2002 9:39 PM
  Subject: Re: XML Schema root element


  Peter,

  Is it you have validation schema set to Val_Auto?  If so, change it to Val_Always, then you should see validation error of the root element.

  How Val_Auto works is:
  1. When the parser enters the xs:ANYNAME, the validation flag is off.  
  2. Then a schema is encountered, the validation flag is then set to on 
  3. So when the parser entering the xs:element, the validation flag is on

  Such validation flag works like a stack, and is being popped and pushed when entering and leaving the element.   Since the validation flag was off when entering xs:ANYNAME, thus the root is not validated but xs:element is.   

  Tinny
    ----- Original Message ----- 
    From: Peter A. Volchek 
    To: Xerces-Dev 
    Sent: Thursday, August 15, 2002 12:52 PM
    Subject: XML Schema root element


    I have noticed that Xerces does not validate the XML schema's root element.
    In other words, it is possible to validate the following schema w/o errors

    <xs:ANYNAME xmlns:xs="http://www.w3.org/2001/XMLSchema">
     <xs:element name="A" type="xs:string"/>
    </xs:ANYNAME>

    Is it bug or just missed item or even allowed situation?

     

Re: XML Schema root element

Posted by Tinny Ng <tn...@ca.ibm.com>.
Peter,

Is it you have validation schema set to Val_Auto?  If so, change it to Val_Always, then you should see validation error of the root element.

How Val_Auto works is:
1. When the parser enters the xs:ANYNAME, the validation flag is off.  
2. Then a schema is encountered, the validation flag is then set to on 
3. So when the parser entering the xs:element, the validation flag is on

Such validation flag works like a stack, and is being popped and pushed when entering and leaving the element.   Since the validation flag was off when entering xs:ANYNAME, thus the root is not validated but xs:element is.   

Tinny
  ----- Original Message ----- 
  From: Peter A. Volchek 
  To: Xerces-Dev 
  Sent: Thursday, August 15, 2002 12:52 PM
  Subject: XML Schema root element


  I have noticed that Xerces does not validate the XML schema's root element.
  In other words, it is possible to validate the following schema w/o errors

  <xs:ANYNAME xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <xs:element name="A" type="xs:string"/>
  </xs:ANYNAME>

  Is it bug or just missed item or even allowed situation?