You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Dirk Reinshagen_C <DR...@zaplet.com> on 2001/03/09 03:23:13 UTC

problems with xpath and schema validation

This may be an FAQ or a known problem....

I have a very simple XML document that I'm encountering an 
issue when evaluating an XPath expression when parser validation
is turned on.  I'm using Xalan 2.0 with Xerces 1.2.3 when 
executing the following XPath:

child::firstname/text()

I get null, but when I turn off parser validation it works as
expected returning "john".  Any ideas/suggestions?



<?xml version="1.0"?>
<customer xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
    xsi:noNamespaceSchemaLocation='customer.xsd'
>
<firstname>john</firstname>
</customer>


<?xml version="1.0"?>
<schema>
   <element name="customer">
      <complexType>
         <sequence>                		                      
             <element name="firstname" type="string" maxOccurs="1"
minOccurs="1"/>
             <element name="lastname" type="string" maxOccurs="1"
minOccurs="0"/>
         </sequence>

      </complexType>
   </element>
</schema>

Re: problems with xpath and schema validation

Posted by Gary L Peskin <ga...@firstech.com>.
Dirk Reinshagen_C wrote:
> 
> This may be an FAQ or a known problem....
> 
> I have a very simple XML document that I'm encountering an
> issue when evaluating an XPath expression when parser validation
> is turned on.  I'm using Xalan 2.0 with Xerces 1.2.3 when
> executing the following XPath:
> 
> child::firstname/text()
> 
> I get null, but when I turn off parser validation it works as
> expected returning "john".  Any ideas/suggestions?
> 

I believe that this is the same problem that I reported over to the
Xerces-J list previously.  With schema validation on, the DOM node
<firstname> is given a namespaceURI of the empty string ("").  Xalan
expects a null namespaceURI indicating that there is no namespace for
<firstname>.

I've reported this over to the Xerces people but I haven't heard
anything back.  Perhaps I'll resend the message over there and try to
get a response.

Gary