You can't do this easily -- mostly because the Xerces DOM_* classes are not
polymorphic, but also because there's no publically exposed implementation
for a NodeList in Xerces.
You _can_ convert individual XalanNode* instances by asking the owning
document to map them: However, this requires that you use Xalan's bride to
the Xerces DOM. If you're using our default source tree implementation,
there's no way to do this.
Here's an example using our wrapper around Xerces:
void
foo(const XercesDocumentBridge* doc)
{
XalanNodeList* nl = doc->getChildNodes();
const unsigned int count = nl->getLength();
for (unsigned int i = 0; i < count; ++i)
{
XalanNode* const current = nl->item(i);
DOM_Node xercesNode(doc->mapNode(current));
// Do something...
}
}
This also requires that you wrap the Xerces DOM document instance into a
Xalan instance:
DOMParser parser;
...
DOM_Document xercesDocument = parser.getDocument();
XercesDOMSupport domSupport;
XercesParserLiaison parserLiaison(domSupport);
XalanDocument* const xalanDoc =
parserLiaison.createDocument(xercesDocument);
XercesDocumentBridge* doc = parserLiaison.mapDocument(xalanDoc);
foo(doc);
Dave
"Yan Hailin"
<[EMAIL PROTECTED] To: <[EMAIL PROTECTED]>
m.sg> cc: (bcc: David N Bertoni/CAM/Lotus)
Subject: Xalan NodeList to Xerces DOM
10/26/2001 NodeList
03:55 AM
Please
respond to
xalan-dev
Hi,
I want to use Xalan and Xpath to get filtered xml elements, how can I
convert the Xalan NodeList to DOM NodeList?
Thanks.
regards,
Yan