You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Nacho Conde <ic...@tid.es> on 2007/03/13 18:18:22 UTC
How to import DomDocument to XalanDoc and Evaluate.
Hi,
I have a code, that convert a DomDocument to a XalanDocument, with the
method createDocument() of XercesParserLiaison and i have the object
XercesDOMSupport initialized.
XercesParserLiaison theParser;
XercesDOMSupport theXercesDomSupport;
theXercesDomSupport()
theParser (theXercesDomSupport)
i parse the DomDocument using this form,
theDocument=theParser.createDocument(&doc);
Then i try to evaluate some xpath expressions and.. if i find nodes
without namespaces, the query is OK however, if i use a query with
namespace to find a node with namespace the result of the query is empty.
The document is ok, if i write the DomDocument to string and then parse
this string with xpath, all works ok..
Some Ideas?
Thanks
Nacho
Re: How to import DomDocument to XalanDoc and Evaluate.
Posted by Nacho Conde <ic...@tid.es>.
Ok, I correct myself, all works OK using the method setDoNamespaces(true)
Thanks
Nacho
Nacho Conde escribió:
> David Bertoni escribió:
>> Nacho Conde wrote:
>>>
>>> Hi,
>>> I have a code, that convert a DomDocument to a XalanDocument, with
>>> the method createDocument() of XercesParserLiaison and i have the
>>> object XercesDOMSupport initialized.
>>>
>>> XercesParserLiaison theParser;
>>> XercesDOMSupport theXercesDomSupport;
>>>
>>> theXercesDomSupport()
>>> theParser (theXercesDomSupport)
>>>
>>> i parse the DomDocument using this form,
>>> theDocument=theParser.createDocument(&doc);
>>>
>>> Then i try to evaluate some xpath expressions and.. if i find nodes
>>> without namespaces, the query is OK however, if i use a query with
>>> namespace to find a node with namespace the result of the query is
>>> empty.
>>
>> Perhaps you aren't building the DOM with namespaces enabled? Using a
>> DOM that was not built with namespaces enabled will result in
>> undefined behavior.
>>
> I am using the XercesDOMParser class, initialized with the method
> "setDoNamespaces(true)", the method getDoNamespaces (for confirm) give
> me a true in response.
>
>>>
>>> The document is ok, if i write the DomDocument to string and then
>>> parse this string with xpath, all works ok..
>>
>> If by "parse this string with xpath" you mean you use
>> XercesParserLiaison.parseXMLStream(), then it works because we enable
>> namespace processing for the DOM we build.
>>
> Yes this is true, using parseXMLStream all works ok.
>
>> Dave
>>
>
> Nacho
>
>
> __________ NOD32 2112 (20070313) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>
Re: How to import DomDocument to XalanDoc and Evaluate.
Posted by Nacho Conde <ic...@tid.es>.
David Bertoni escribió:
> Nacho Conde wrote:
>>
>> Hi,
>> I have a code, that convert a DomDocument to a XalanDocument, with
>> the method createDocument() of XercesParserLiaison and i have the
>> object XercesDOMSupport initialized.
>>
>> XercesParserLiaison theParser;
>> XercesDOMSupport theXercesDomSupport;
>>
>> theXercesDomSupport()
>> theParser (theXercesDomSupport)
>>
>> i parse the DomDocument using this form,
>> theDocument=theParser.createDocument(&doc);
>>
>> Then i try to evaluate some xpath expressions and.. if i find nodes
>> without namespaces, the query is OK however, if i use a query with
>> namespace to find a node with namespace the result of the query is
>> empty.
>
> Perhaps you aren't building the DOM with namespaces enabled? Using a
> DOM that was not built with namespaces enabled will result in
> undefined behavior.
>
I am using the XercesDOMParser class, initialized with the method
"setDoNamespaces(true)", the method getDoNamespaces (for confirm) give
me a true in response.
>>
>> The document is ok, if i write the DomDocument to string and then
>> parse this string with xpath, all works ok..
>
> If by "parse this string with xpath" you mean you use
> XercesParserLiaison.parseXMLStream(), then it works because we enable
> namespace processing for the DOM we build.
>
Yes this is true, using parseXMLStream all works ok.
> Dave
>
Nacho
Re: How to import DomDocument to XalanDoc and Evaluate.
Posted by David Bertoni <db...@apache.org>.
Nacho Conde wrote:
>
> Hi,
> I have a code, that convert a DomDocument to a XalanDocument, with the
> method createDocument() of XercesParserLiaison and i have the object
> XercesDOMSupport initialized.
>
> XercesParserLiaison theParser;
> XercesDOMSupport theXercesDomSupport;
>
> theXercesDomSupport()
> theParser (theXercesDomSupport)
>
> i parse the DomDocument using this form,
> theDocument=theParser.createDocument(&doc);
>
> Then i try to evaluate some xpath expressions and.. if i find nodes
> without namespaces, the query is OK however, if i use a query with
> namespace to find a node with namespace the result of the query is empty.
Perhaps you aren't building the DOM with namespaces enabled? Using a DOM
that was not built with namespaces enabled will result in undefined behavior.
>
> The document is ok, if i write the DomDocument to string and then parse
> this string with xpath, all works ok..
If by "parse this string with xpath" you mean you use
XercesParserLiaison.parseXMLStream(), then it works because we enable
namespace processing for the DOM we build.
Dave