You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Anne Chinn <An...@Ingeniux.com> on 2000/11/17 00:29:54 UTC

how do I do the equivalent of MSFT selectNodes?

I am new to xerces/xalan and am porting our msft code (using msxml) to
apache.

What I want to be able to do is execute a query against an xml document and
generate a text representation for the xml nodes that represent the
resultset.

With msft's msxml I used the IXMLDOMNodes::selectNodes method and then the
IXMLDOMNode::get_xml method to get the text representation for each element
in the returned list.

I am having difficulty determining how to do this with xerces/xalan.  I have
been looking at the XPathWrapper sample for what I thought was the correct
way to do this, but I don't know how to get the text representation from the
returned NodeList.  I want a string representation for each element.
DOMSupport::getNodeData doesn't do what I want for an element.

RE: how do I do the equivalent of MSFT selectNodes?

Posted by Dan Wahlin <wa...@home.com>.
I may be wrong (I'm also knew to Xerces and Xalan) but I don't believe there
is the equivalent of a get_xml (node.xml) method as with the MSXML parser
since this isn't in the XML spec.  If you look at the Xerces samples though,
you can see how to serialize the node and get the resulting XML.  Take a
look at the DOMGenerate samples found with Xerces to see the classes you
need.

Dan

-----Original Message-----
From: Anne Chinn [mailto:Anne.Chinn@Ingeniux.com]
Sent: Thursday, November 16, 2000 4:30 PM
To: 'xalan-dev@xml.apache.org'
Subject: how do I do the equivalent of MSFT selectNodes?


I am new to xerces/xalan and am porting our msft code (using msxml) to
apache.

What I want to be able to do is execute a query against an xml document and
generate a text representation for the xml nodes that represent the
resultset.

With msft's msxml I used the IXMLDOMNodes::selectNodes method and then the
IXMLDOMNode::get_xml method to get the text representation for each element
in the returned list.

I am having difficulty determining how to do this with xerces/xalan.  I have
been looking at the XPathWrapper sample for what I thought was the correct
way to do this, but I don't know how to get the text representation from the
returned NodeList.  I want a string representation for each element.
DOMSupport::getNodeData doesn't do what I want for an element.