You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org> on 2009/02/14 05:42:59 UTC

[jira] Assigned: (XERCESJ-1351) Type alternatives implementation seems to be broken

     [ https://issues.apache.org/jira/browse/XERCESJ-1351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glavassevich reassigned XERCESJ-1351:
---------------------------------------------

    Assignee: Michael Glavassevich  (was: Khaled Noaman)

> Type alternatives implementation seems to be broken
> ---------------------------------------------------
>
>                 Key: XERCESJ-1351
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1351
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.1 Structures
>    Affects Versions: 2.9.1
>         Environment: Windows XP, JRE 1.5.0_15
>            Reporter: Mukul Gandhi
>            Assignee: Michael Glavassevich
>         Attachments: type-alternatives.patch
>
>
> I am running the latest Xerces-J development code from SVN repository. I tried the following sample XML document, and the XML Schema document.
> XML document:
> <PERSON xsi:noNamespaceSchemaLocation="person.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>   <FNAME>Mukul</FNAME>
>   <LNAME>Gandhi</LNAME>
>   <DOB>1999-06-02</DOB>
>   <ADDRESS type="short">my address</ADDRESS>
> </PERSON>
> Schema:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>    
>    <xs:element name="PERSON" type="PersonType" />
>    <xs:complexType name="PersonType">
>       <xs:sequence>
>         <xs:element name="FNAME" type="xs:string" />
>         <xs:element name="LNAME" type="xs:string" />
> 	<xs:element name="DOB" type="xs:date" />
> 	<xs:element name="ADDRESS" type="LongAddress">
>           <xs:alternative test="@type='short'" type="ShortAddress"/>
> 	  <xs:alternative test="@type='long'" type="LongAddress"/>
> 	</xs:element>
>       </xs:sequence>
>    </xs:complexType>
>    <xs:complexType name="ShortAddress"> 
>      <xs:simpleContent> 
>        <xs:extension base="shortString"> 
>          <xs:attribute name="type" type="xs:string"/> 
>        </xs:extension> 
>      </xs:simpleContent> 
>    </xs:complexType> 
>    <xs:simpleType name="shortString"> 
>      <xs:restriction base="xs:string"> 
>        <xs:minLength value="1" /> 
>        <xs:maxLength value="50" /> 
>      </xs:restriction> 
>    </xs:simpleType>
>    <xs:complexType name="LongAddress">
>      <xs:sequence>
>        <xs:element name="street1" type="xs:string" />
>        <xs:element name="street2" type="xs:string" minOccurs="0" />
>        <xs:element name="city" type="xs:string" />
>        <xs:element name="state" type="xs:string" />
>        <xs:element name="pin" type="xs:string" />
>        <xs:element name="country" type="xs:string" />
>      </xs:sequence>
>      <xs:attribute name="type" type="xs:string"/>
>    </xs:complexType>
> </xs:schema>
> When I apply validation using the above examples, with Xerces, I get following errors:
> [Error] person.xsd:11:69: s4s-elt-must-match.1: The content of 'ADDRESS' must match (annotation?, (simpleType
> | complexType)?, alternative*, (unique | key | keyref)*)). A problem was found starting at: alternative.
> [Error] person.xml:5:45: cvc-complex-type.2.3: Element 'ADDRESS' cannot have character [children], because the
>  type's content type is element-only.
> [Error] person.xml:5:45: cvc-complex-type.2.4.b: The content of element 'ADDRESS' is not complete. One of '{st
> reet1}' is expected.
> It seems to me, that type alternative support in Xerces is not working as expected.
> Some comments about the Java class, org.apache.xerces.impl.xpath.XPath20 (which I think is used by type alternatives)
> The method, 
> public boolean  evaluateNodeTest(QName element, XMLAttributes attributes) 
> doesn't use the parameter, "element" anywhere in the method body.
> Please correct me, on any of the points I have mentioned.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


Re: [jira] Assigned: (XERCESJ-1351) Type alternatives implementation seems to be broken

Posted by Hiranya Jayathilaka <hi...@gmail.com>.
Hi MIchael,
Comments in-line.

On Mon, Mar 9, 2009 at 9:53 AM, Michael Glavassevich <mr...@ca.ibm.com>wrote:

> Hi Hiranya,
>
> To get a feel of the new code I put together what I thought was a simple
> test, but I'm getting a NPE when I try running it:
>

In the patch I submitted, type alternatives are evaluated at the end of the
handleStartElement method of the XMLSchemaValidator. This is the cause of
the problem. I tried moving the type alternatives evaluation code further up
in the method so that they are processed before anything else (which is the
correct way of doing it) and I don't see any exceptions any more. I tried
your sample as well as some of my old samples and everything seems to work
fine.


>
>
> java.lang.NullPointerException
>  at
> org.apache.xerces.impl.xs.XMLSchemaValidator.elementLocallyValidComplexType(XMLSchemaValidator.java:3427)
>  at
> org.apache.xerces.impl.xs.XMLSchemaValidator.elementLocallyValidType(XMLSchemaValidator.java:3376)
>  at
> org.apache.xerces.impl.xs.XMLSchemaValidator.processElementContent(XMLSchemaValidator.java:3278)
>  at
> org.apache.xerces.impl.xs.XMLSchemaValidator.handleEndElement(XMLSchemaValidator.java:2356)
>  at
> org.apache.xerces.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:888)
>  at
> org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.endElement(ValidatorHandlerImpl.java:592)
>  at
> org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:590)
>  at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:673)
>  at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1645)
>  at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
>  at
> org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:864)
>  at
> org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:787)
>  at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
>  at
> org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1190)
>  at
> org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.validate(ValidatorHandlerImpl.java:740)
>  at
> org.apache.xerces.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:108)
>  at javax.xml.validation.Validator.validate(Unknown Source)
>  at jaxp.SourceValidator.validate(SourceValidator.java:147)
>  at jaxp.SourceValidator.main(SourceValidator.java:518)
>
> I've attached the schema and instance document so you can have a look. I'm
> going to try some other schemas / expressions but one thing I'm curious
> about as I've started reviewing your patch is the try / catch added to
> XMLSchemaValidator. I thought the result of evaluation would always be a
> boolean (true of false). What conditions would this fail with an exception?
> Creating/throwing exceptions is expensive. Could it just return false in
> such cases?
>

I made a few changes so that the Test class does not throw any exceptions to
the XMLSchemaValidator. The structures spec also states that if a dynamic
error or a type error is raised during test evaluation that test should be
considered failed. So now the Test class returns false in such occasions.
However exceptions are still being thrown at the XPath parser level.
According to the XPath spec there are situations where dynamic/type errors
could occur during  expression validation and so I believe it is necessary
to have exceptions thrown at that level.

Basically exceptions occur at the parser level in the following situations.

1. If two incompatible types are compared
2. If a cast is performed among two incompatible types

In the current implementation any dynamic exception that occurs would cause
the test to fail immediately.

I have attached the updated patch herewith.

Thanks,
Hiranya


>
>
> *(See attached file: cta2.xsd)**(See attached file: cta2.xml)*
>
>
> Thanks.
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> Michael Glavassevich/Toronto/IBM@IBMCA wrote on 03/08/2009 01:13:50 PM:
>
>
> > Hi Hiranya,
> >
> > It's been on my TODO list for awhile. I'll try to find some time
> > today to review it.
> >
> > Thanks.
> >
> > Michael Glavassevich
> > XML Parser Development
> > IBM Toronto Lab
> > E-mail: mrglavas@ca.ibm.com
> > E-mail: mrglavas@apache.org
> >
> > Hiranya Jayathilaka <hi...@gmail.com> wrote on 03/08/2009 10:09:09
> AM:
> >
> > > Hi Folks,
> > >
> > > Just wanted to know the current status of this issue. If I can get
> > > some feedback regarding the patch I can start working on finalizing
> > > it by incorporating the changes made to the spec recently.
> > >
> > > Thanks,
> > > Hiranya
> >
> > > On Sat, Feb 14, 2009 at 10:12 AM, Michael Glavassevich (JIRA) <
> > > xerces-j-dev@xml.apache.org> wrote:
> > >
> > >     [ https://issues.apache.org/jira/browse/XERCESJ-1351?page=com.
> > > atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
> > >
> > > Michael Glavassevich reassigned XERCESJ-1351:
> > > ---------------------------------------------
> >
> > >    Assignee: Michael Glavassevich  (was: Khaled Noaman)
> > >
> > > > Type alternatives implementation seems to be broken
> > > > ---------------------------------------------------
> > > >
> > > >                 Key: XERCESJ-1351
> > > >                 URL:
> https://issues.apache.org/jira/browse/XERCESJ-1351
> > > >             Project: Xerces2-J
> > > >          Issue Type: Bug
> > > >          Components: XML Schema 1.1 Structures
> > > >    Affects Versions: 2.9.1
> > > >         Environment: Windows XP, JRE 1.5.0_15
> > > >            Reporter: Mukul Gandhi
> > > >            Assignee: Michael Glavassevich
> > > >         Attachments: type-alternatives.patch
> > > >
> > > >
> > > > I am running the latest Xerces-J development code from SVN
> > > repository. I tried the following sample XML document, and the XML
> > > Schema document.
> > > > XML document:
> > > > <PERSON xsi:noNamespaceSchemaLocation="person.xsd" xmlns:xsi="
> > > http://www.w3.org/2001/XMLSchema-instance">
> > > >   <FNAME>Mukul</FNAME>
> > > >   <LNAME>Gandhi</LNAME>
> > > >   <DOB>1999-06-02</DOB>
> > > >   <ADDRESS type="short">my address</ADDRESS>
> > > > </PERSON>
> > > > Schema:
> > > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > >
> > > >    <xs:element name="PERSON" type="PersonType" />
> > > >    <xs:complexType name="PersonType">
> > > >       <xs:sequence>
> > > >         <xs:element name="FNAME" type="xs:string" />
> > > >         <xs:element name="LNAME" type="xs:string" />
> > > >       <xs:element name="DOB" type="xs:date" />
> > > >       <xs:element name="ADDRESS" type="LongAddress">
> > > >           <xs:alternative test="@type='short'" type="ShortAddress"/>
> > > >         <xs:alternative test="@type='long'" type="LongAddress"/>
> > > >       </xs:element>
> > > >       </xs:sequence>
> > > >    </xs:complexType>
> > > >    <xs:complexType name="ShortAddress">
> > > >      <xs:simpleContent>
> > > >        <xs:extension base="shortString">
> > > >          <xs:attribute name="type" type="xs:string"/>
> > > >        </xs:extension>
> > > >      </xs:simpleContent>
> > > >    </xs:complexType>
> > > >    <xs:simpleType name="shortString">
> > > >      <xs:restriction base="xs:string">
> > > >        <xs:minLength value="1" />
> > > >        <xs:maxLength value="50" />
> > > >      </xs:restriction>
> > > >    </xs:simpleType>
> > > >    <xs:complexType name="LongAddress">
> > > >      <xs:sequence>
> > > >        <xs:element name="street1" type="xs:string" />
> > > >        <xs:element name="street2" type="xs:string" minOccurs="0" />
> > > >        <xs:element name="city" type="xs:string" />
> > > >        <xs:element name="state" type="xs:string" />
> > > >        <xs:element name="pin" type="xs:string" />
> > > >        <xs:element name="country" type="xs:string" />
> > > >      </xs:sequence>
> > > >      <xs:attribute name="type" type="xs:string"/>
> > > >    </xs:complexType>
> > > > </xs:schema>
> > > > When I apply validation using the above examples, with Xerces, I
> > > get following errors:
> > > > [Error] person.xsd:11:69: s4s-elt-must-match.1: The content of
> > > 'ADDRESS' must match (annotation?, (simpleType
> > > > | complexType)?, alternative*, (unique | key | keyref)*)). A
> > > problem was found starting at: alternative.
> > > > [Error] person.xml:5:45: cvc-complex-type.2.3: Element 'ADDRESS'
> > > cannot have character [children], because the
> > > >  type's content type is element-only.
> > > > [Error] person.xml:5:45: cvc-complex-type.2.4.b: The content of
> > > element 'ADDRESS' is not complete. One of '{st
> > > > reet1}' is expected.
> > > > It seems to me, that type alternative support in Xerces is not
> > > working as expected.
> > > > Some comments about the Java class, org.apache.xerces.impl.xpath.
> > > XPath20 (which I think is used by type alternatives)
> > > > The method,
> > > > public boolean  evaluateNodeTest(QName element, XMLAttributes
> attributes)
> > > > doesn't use the parameter, "element" anywhere in the method body.
> > > > Please correct me, on any of the points I have mentioned.
> > >
> > > --
> > > This message is automatically generated by JIRA.
> > > -
> > > You can reply to this email to add a comment to the issue online.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
> > > For additional commands, e-mail: j-dev-help@xerces.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-dev-help@xerces.apache.org
>

Re: [jira] Assigned: (XERCESJ-1351) Type alternatives implementation seems to be broken

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Hiranya,

To get a feel of the new code I put together what I thought was a simple
test, but I'm getting a NPE when I try running it:

java.lang.NullPointerException
      at
org.apache.xerces.impl.xs.XMLSchemaValidator.elementLocallyValidComplexType(XMLSchemaValidator.java:3427)
      at
org.apache.xerces.impl.xs.XMLSchemaValidator.elementLocallyValidType(XMLSchemaValidator.java:3376)
      at
org.apache.xerces.impl.xs.XMLSchemaValidator.processElementContent(XMLSchemaValidator.java:3278)
      at
org.apache.xerces.impl.xs.XMLSchemaValidator.handleEndElement(XMLSchemaValidator.java:2356)
      at
org.apache.xerces.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:888)
      at
org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.endElement(ValidatorHandlerImpl.java:592)
      at
org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:590)
      at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:673)
      at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1645)
      at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
      at
org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:864)
      at
org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:787)
      at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
      at
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1190)
      at
org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.validate(ValidatorHandlerImpl.java:740)
      at
org.apache.xerces.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:108)
      at javax.xml.validation.Validator.validate(Unknown Source)
      at jaxp.SourceValidator.validate(SourceValidator.java:147)
      at jaxp.SourceValidator.main(SourceValidator.java:518)

I've attached the schema and instance document so you can have a look. I'm
going to try some other schemas / expressions but one thing I'm curious
about as I've started reviewing your patch is the try / catch added to
XMLSchemaValidator. I thought the result of evaluation would always be a
boolean (true of false). What conditions would this fail with an exception?
Creating/throwing exceptions is expensive. Could it just return false in
such cases?

(See attached file: cta2.xsd)(See attached file: cta2.xml)

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Michael Glavassevich/Toronto/IBM@IBMCA wrote on 03/08/2009 01:13:50 PM:

> Hi Hiranya,
>
> It's been on my TODO list for awhile. I'll try to find some time
> today to review it.
>
> Thanks.
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> Hiranya Jayathilaka <hi...@gmail.com> wrote on 03/08/2009 10:09:09
AM:
>
> > Hi Folks,
> >
> > Just wanted to know the current status of this issue. If I can get
> > some feedback regarding the patch I can start working on finalizing
> > it by incorporating the changes made to the spec recently.
> >
> > Thanks,
> > Hiranya
>
> > On Sat, Feb 14, 2009 at 10:12 AM, Michael Glavassevich (JIRA) <
> > xerces-j-dev@xml.apache.org> wrote:
> >
> > � � [ https://issues.apache.org/jira/browse/XERCESJ-1351?page=com.
> > atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
> >
> > Michael Glavassevich reassigned XERCESJ-1351:
> > ---------------------------------------------
>
> > � �Assignee: Michael Glavassevich �(was: Khaled Noaman)
> >
> > > Type alternatives implementation seems to be broken
> > > ---------------------------------------------------
> > >
> > > � � � � � � � � Key: XERCESJ-1351
> > > � � � � � � � � URL:
https://issues.apache.org/jira/browse/XERCESJ-1351
> > > � � � � � � Project: Xerces2-J
> > > � � � � �Issue Type: Bug
> > > � � � � �Components: XML Schema 1.1 Structures
> > > � �Affects Versions: 2.9.1
> > > � � � � Environment: Windows XP, JRE 1.5.0_15
> > > � � � � � �Reporter: Mukul Gandhi
> > > � � � � � �Assignee: Michael Glavassevich
> > > � � � � Attachments: type-alternatives.patch
> > >
> > >
> > > I am running the latest Xerces-J development code from SVN
> > repository. I tried the following sample XML document, and the XML
> > Schema document.
> > > XML document:
> > > <PERSON xsi:noNamespaceSchemaLocation="person.xsd" xmlns:xsi="
> > http://www.w3.org/2001/XMLSchema-instance">
> > > � <FNAME>Mukul</FNAME>
> > > � <LNAME>Gandhi</LNAME>
> > > � <DOB>1999-06-02</DOB>
> > > � <ADDRESS type="short">my address</ADDRESS>
> > > </PERSON>
> > > Schema:
> > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > >
> > > � �<xs:element name="PERSON" type="PersonType" />
> > > � �<xs:complexType name="PersonType">
> > > � � � <xs:sequence>
> > > � � � � <xs:element name="FNAME" type="xs:string" />
> > > � � � � <xs:element name="LNAME" type="xs:string" />
> > > � � � <xs:element name="DOB" type="xs:date" />
> > > � � � <xs:element name="ADDRESS" type="LongAddress">
> > > � � � � � <xs:alternative test="@type='short'" type="ShortAddress"/>
> > > � � � � <xs:alternative test="@type='long'" type="LongAddress"/>
> > > � � � </xs:element>
> > > � � � </xs:sequence>
> > > � �</xs:complexType>
> > > � �<xs:complexType name="ShortAddress">
> > > � � �<xs:simpleContent>
> > > � � � �<xs:extension base="shortString">
> > > � � � � �<xs:attribute name="type" type="xs:string"/>
> > > � � � �</xs:extension>
> > > � � �</xs:simpleContent>
> > > � �</xs:complexType>
> > > � �<xs:simpleType name="shortString">
> > > � � �<xs:restriction base="xs:string">
> > > � � � �<xs:minLength value="1" />
> > > � � � �<xs:maxLength value="50" />
> > > � � �</xs:restriction>
> > > � �</xs:simpleType>
> > > � �<xs:complexType name="LongAddress">
> > > � � �<xs:sequence>
> > > � � � �<xs:element name="street1" type="xs:string" />
> > > � � � �<xs:element name="street2" type="xs:string" minOccurs="0" />
> > > � � � �<xs:element name="city" type="xs:string" />
> > > � � � �<xs:element name="state" type="xs:string" />
> > > � � � �<xs:element name="pin" type="xs:string" />
> > > � � � �<xs:element name="country" type="xs:string" />
> > > � � �</xs:sequence>
> > > � � �<xs:attribute name="type" type="xs:string"/>
> > > � �</xs:complexType>
> > > </xs:schema>
> > > When I apply validation using the above examples, with Xerces, I
> > get following errors:
> > > [Error] person.xsd:11:69: s4s-elt-must-match.1: The content of
> > 'ADDRESS' must match (annotation?, (simpleType
> > > | complexType)?, alternative*, (unique | key | keyref)*)). A
> > problem was found starting at: alternative.
> > > [Error] person.xml:5:45: cvc-complex-type.2.3: Element 'ADDRESS'
> > cannot have character [children], because the
> > > �type's content type is element-only.
> > > [Error] person.xml:5:45: cvc-complex-type.2.4.b: The content of
> > element 'ADDRESS' is not complete. One of '{st
> > > reet1}' is expected.
> > > It seems to me, that type alternative support in Xerces is not
> > working as expected.
> > > Some comments about the Java class, org.apache.xerces.impl.xpath.
> > XPath20 (which I think is used by type alternatives)
> > > The method,
> > > public boolean �evaluateNodeTest(QName element, XMLAttributes
attributes)
> > > doesn't use the parameter, "element" anywhere in the method body.
> > > Please correct me, on any of the points I have mentioned.
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > You can reply to this email to add a comment to the issue online.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
> > For additional commands, e-mail: j-dev-help@xerces.apache.org

Re: [jira] Assigned: (XERCESJ-1351) Type alternatives implementation seems to be broken

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Hiranya,

It's been on my TODO list for awhile. I'll try to find some time today to
review it.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Hiranya Jayathilaka <hi...@gmail.com> wrote on 03/08/2009 10:09:09 AM:

> Hi Folks,
>
> Just wanted to know the current status of this issue. If I can get
> some feedback regarding the patch I can start working on finalizing
> it by incorporating the changes made to the spec recently.
>
> Thanks,
> Hiranya

> On Sat, Feb 14, 2009 at 10:12 AM, Michael Glavassevich (JIRA) <
> xerces-j-dev@xml.apache.org> wrote:
>
>     [ https://issues.apache.org/jira/browse/XERCESJ-1351?page=com.
> atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Michael Glavassevich reassigned XERCESJ-1351:
> ---------------------------------------------

>    Assignee: Michael Glavassevich  (was: Khaled Noaman)
>
> > Type alternatives implementation seems to be broken
> > ---------------------------------------------------
> >
> >                 Key: XERCESJ-1351
> >                 URL: https://issues.apache.org/jira/browse/XERCESJ-1351
> >             Project: Xerces2-J
> >          Issue Type: Bug
> >          Components: XML Schema 1.1 Structures
> >    Affects Versions: 2.9.1
> >         Environment: Windows XP, JRE 1.5.0_15
> >            Reporter: Mukul Gandhi
> >            Assignee: Michael Glavassevich
> >         Attachments: type-alternatives.patch
> >
> >
> > I am running the latest Xerces-J development code from SVN
> repository. I tried the following sample XML document, and the XML
> Schema document.
> > XML document:
> > <PERSON xsi:noNamespaceSchemaLocation="person.xsd" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance">
> >   <FNAME>Mukul</FNAME>
> >   <LNAME>Gandhi</LNAME>
> >   <DOB>1999-06-02</DOB>
> >   <ADDRESS type="short">my address</ADDRESS>
> > </PERSON>
> > Schema:
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> >
> >    <xs:element name="PERSON" type="PersonType" />
> >    <xs:complexType name="PersonType">
> >       <xs:sequence>
> >         <xs:element name="FNAME" type="xs:string" />
> >         <xs:element name="LNAME" type="xs:string" />
> >       <xs:element name="DOB" type="xs:date" />
> >       <xs:element name="ADDRESS" type="LongAddress">
> >           <xs:alternative test="@type='short'" type="ShortAddress"/>
> >         <xs:alternative test="@type='long'" type="LongAddress"/>
> >       </xs:element>
> >       </xs:sequence>
> >    </xs:complexType>
> >    <xs:complexType name="ShortAddress">
> >      <xs:simpleContent>
> >        <xs:extension base="shortString">
> >          <xs:attribute name="type" type="xs:string"/>
> >        </xs:extension>
> >      </xs:simpleContent>
> >    </xs:complexType>
> >    <xs:simpleType name="shortString">
> >      <xs:restriction base="xs:string">
> >        <xs:minLength value="1" />
> >        <xs:maxLength value="50" />
> >      </xs:restriction>
> >    </xs:simpleType>
> >    <xs:complexType name="LongAddress">
> >      <xs:sequence>
> >        <xs:element name="street1" type="xs:string" />
> >        <xs:element name="street2" type="xs:string" minOccurs="0" />
> >        <xs:element name="city" type="xs:string" />
> >        <xs:element name="state" type="xs:string" />
> >        <xs:element name="pin" type="xs:string" />
> >        <xs:element name="country" type="xs:string" />
> >      </xs:sequence>
> >      <xs:attribute name="type" type="xs:string"/>
> >    </xs:complexType>
> > </xs:schema>
> > When I apply validation using the above examples, with Xerces, I
> get following errors:
> > [Error] person.xsd:11:69: s4s-elt-must-match.1: The content of
> 'ADDRESS' must match (annotation?, (simpleType
> > | complexType)?, alternative*, (unique | key | keyref)*)). A
> problem was found starting at: alternative.
> > [Error] person.xml:5:45: cvc-complex-type.2.3: Element 'ADDRESS'
> cannot have character [children], because the
> >  type's content type is element-only.
> > [Error] person.xml:5:45: cvc-complex-type.2.4.b: The content of
> element 'ADDRESS' is not complete. One of '{st
> > reet1}' is expected.
> > It seems to me, that type alternative support in Xerces is not
> working as expected.
> > Some comments about the Java class, org.apache.xerces.impl.xpath.
> XPath20 (which I think is used by type alternatives)
> > The method,
> > public boolean  evaluateNodeTest(QName element, XMLAttributes
attributes)
> > doesn't use the parameter, "element" anywhere in the method body.
> > Please correct me, on any of the points I have mentioned.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-dev-help@xerces.apache.org

Re: [jira] Assigned: (XERCESJ-1351) Type alternatives implementation seems to be broken

Posted by Hiranya Jayathilaka <hi...@gmail.com>.
Hi Folks,
Just wanted to know the current status of this issue. If I can get some
feedback regarding the patch I can start working on finalizing it by
incorporating the changes made to the spec recently.

Thanks,
Hiranya

On Sat, Feb 14, 2009 at 10:12 AM, Michael Glavassevich (JIRA) <
xerces-j-dev@xml.apache.org> wrote:

>
>     [
> https://issues.apache.org/jira/browse/XERCESJ-1351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>
> Michael Glavassevich reassigned XERCESJ-1351:
> ---------------------------------------------
>
>     Assignee: Michael Glavassevich  (was: Khaled Noaman)
>
> > Type alternatives implementation seems to be broken
> > ---------------------------------------------------
> >
> >                 Key: XERCESJ-1351
> >                 URL: https://issues.apache.org/jira/browse/XERCESJ-1351
> >             Project: Xerces2-J
> >          Issue Type: Bug
> >          Components: XML Schema 1.1 Structures
> >    Affects Versions: 2.9.1
> >         Environment: Windows XP, JRE 1.5.0_15
> >            Reporter: Mukul Gandhi
> >            Assignee: Michael Glavassevich
> >         Attachments: type-alternatives.patch
> >
> >
> > I am running the latest Xerces-J development code from SVN repository. I
> tried the following sample XML document, and the XML Schema document.
> > XML document:
> > <PERSON xsi:noNamespaceSchemaLocation="person.xsd" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance">
> >   <FNAME>Mukul</FNAME>
> >   <LNAME>Gandhi</LNAME>
> >   <DOB>1999-06-02</DOB>
> >   <ADDRESS type="short">my address</ADDRESS>
> > </PERSON>
> > Schema:
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> >
> >    <xs:element name="PERSON" type="PersonType" />
> >    <xs:complexType name="PersonType">
> >       <xs:sequence>
> >         <xs:element name="FNAME" type="xs:string" />
> >         <xs:element name="LNAME" type="xs:string" />
> >       <xs:element name="DOB" type="xs:date" />
> >       <xs:element name="ADDRESS" type="LongAddress">
> >           <xs:alternative test="@type='short'" type="ShortAddress"/>
> >         <xs:alternative test="@type='long'" type="LongAddress"/>
> >       </xs:element>
> >       </xs:sequence>
> >    </xs:complexType>
> >    <xs:complexType name="ShortAddress">
> >      <xs:simpleContent>
> >        <xs:extension base="shortString">
> >          <xs:attribute name="type" type="xs:string"/>
> >        </xs:extension>
> >      </xs:simpleContent>
> >    </xs:complexType>
> >    <xs:simpleType name="shortString">
> >      <xs:restriction base="xs:string">
> >        <xs:minLength value="1" />
> >        <xs:maxLength value="50" />
> >      </xs:restriction>
> >    </xs:simpleType>
> >    <xs:complexType name="LongAddress">
> >      <xs:sequence>
> >        <xs:element name="street1" type="xs:string" />
> >        <xs:element name="street2" type="xs:string" minOccurs="0" />
> >        <xs:element name="city" type="xs:string" />
> >        <xs:element name="state" type="xs:string" />
> >        <xs:element name="pin" type="xs:string" />
> >        <xs:element name="country" type="xs:string" />
> >      </xs:sequence>
> >      <xs:attribute name="type" type="xs:string"/>
> >    </xs:complexType>
> > </xs:schema>
> > When I apply validation using the above examples, with Xerces, I get
> following errors:
> > [Error] person.xsd:11:69: s4s-elt-must-match.1: The content of 'ADDRESS'
> must match (annotation?, (simpleType
> > | complexType)?, alternative*, (unique | key | keyref)*)). A problem was
> found starting at: alternative.
> > [Error] person.xml:5:45: cvc-complex-type.2.3: Element 'ADDRESS' cannot
> have character [children], because the
> >  type's content type is element-only.
> > [Error] person.xml:5:45: cvc-complex-type.2.4.b: The content of element
> 'ADDRESS' is not complete. One of '{st
> > reet1}' is expected.
> > It seems to me, that type alternative support in Xerces is not working as
> expected.
> > Some comments about the Java class, org.apache.xerces.impl.xpath.XPath20
> (which I think is used by type alternatives)
> > The method,
> > public boolean  evaluateNodeTest(QName element, XMLAttributes attributes)
> > doesn't use the parameter, "element" anywhere in the method body.
> > Please correct me, on any of the points I have mentioned.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-dev-help@xerces.apache.org
>
>