David,

you are the best! I really had previously set:
        if (pBuilder->canSetFeature(xtcxml::XMLUni::fgDOMNamespaces, false))
                pBuilder->setFeature(xtcxml::XMLUni::fgDOMNamespaces, false);

This bloody setting cost me really much time! Thank you very much for
your assumption which was true.

Hope this post will help others to identify their possible errors.

Many thanks,

-- 
Ovanes Markarian

-----Original Message-----
Date: Fri, 18 Nov 2005 08:22:06 +0100
Subject: Re: Applying xPath to Xerces DOMDocument fails
From: David Bertoni 
To:  xalan-c-users@xml.apache.org

[EMAIL PROTECTED] wrote:
> David,
> thanks for your answer. The sample code and text documents are at
work.
> What I can remember until now is that I stepped into the xPath
> evaluation function and set breakpoint for the namespace resolution.
> Somehow the default resolver used by Xalan always delivered null for
the
> prefix. But my root element definitely has some specified namespaces.
>
>
> A possible sample document could be the following:
> 
> xmlns:cf="http://my_unique_url_2"; xmlns:gen="http://my_unique_url_3";
> xmlns:xsi="schema-default-instance-which-I-currently-do-not-remember"
> xmlns:schemaLocation="http://my_unique_url_1 ./schema1.xsd etc..."
> att1="some text" att2="some text2">
>   
>       
>       
>   
> 
>
> xPath expression is:
> /tcs:root/tcs:sub1/cf:[EMAIL PROTECTED]:id='123']
>
> This is fine with your sample. But if I parse it with a non-validating
> Xerces-C 2.7.0 parser and pass the DOM as described below I receive
> NULL-Pointer.
>

If it works with the sample application, but not with the Xerces-C DOM
you build, then you should verify you are building a namespace-aware
DOM.  Insert a call to setDoNamespaces(true) on the parsrer instance,
before you call the parse() member function.

Dave


Reply via email to