See TreeWalker::traverseSubtree(), which was introduced in 1.3.
Dave
Charles
Nicholson To: "'Tankel, Ifat'"
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED] cc:
"'[email protected]'"
idnet.com> <[email protected]>,
(bcc: David N
Bertoni/Cambridge/IBM)
03/07/2002 06:55 Subject: RE: removeChild of
xalanNode (found by xpath) from
AM parsed xml fil e throw
XalanDomExeption
Hello-
We serialize DOM documents to memory buffers like this:
-----------------------------------------------------------------------------------------------------------------------------
XalanDocument *document; // assume below that it's initialized and valid
stringstream target_stream; // this is the output stream
XalanStdOutputStream output_stream(target_stream);
XalanOutputStreamPrintWriter writer(output_stream);
FormatterToXML formatter(writer);
FormatterTreeWalker tree_walker(formatter);
tree_walker.traverse(document);
// at this point, target_stream contains the serialized DOM Document.
// access the raw 'char *' type with target_stream.str().c_str().
-------------------------------------------------------------------------------------------------------------------------------
and it seems to work pretty well. One problem we have is that this method
does not allow partial serialization (i.e. you can't serialize just a
subtree, it looks to us like an issue in the implementation of
FormatterTreeWalker::traverse, but we could simply be using it wrong. Has
anyone else encountered this?
Regards,
-Charles Nicholson