Why do you have to copy the code from the impl class?  DOMWriter seems to consist 
entirely of virtual functions, so you should be able to override writeNode() and 
handle your user data or call the inherited DOMWriter::writeNode().  
Unfortunately, I think you will have to also override DOMImplementationLS in order to 
construct your DOMWriter, and override DOMImplementationRegistry in order to construct 
your DOMImplemenation LS.

Adam Heinz
Senior Software Developer
Exstream Software



-----Original Message-----
From: Rich Stephens [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 25, 2004 2:28 PM
To: [EMAIL PROTECTED]
Subject: Best way to custom serialize a DOMElement node?


First off, forgive me if this is not the proper forum for this question.
I did not see a xerces-c-users list at xml.apache.org.

I have a DOMDocument which contains DOMElements which have attached
UserData using the setUserData() function.

I want to be able to interrupt the writing of the DOMElement nodes when
serializing using a DOMWriter so I can output specific stuff found in my
UserData.  I still want to be able to make use of the formatter used by
the DOMWriter so I don't have to recreate all the smart stuff it does
regarding transcoding, escaping, etc.

I have been investigating this, and so far, it appears I have but one
choice:  implement a DOMNodeFilter that sends back
DOMNodeFilter::FILTER_SKIP from its acceptNode() member function, and
set it to the filter for an object based on DOMWriterImpl so I can make
use of its formatter and other handy functions, and serialize the
element node myself.

Another thought was to override writeNode() itself, copy almost all the
code from the DomWriterImpl class, and just modify the part that does
element nodes.

Am I going about this in too complicated a manner?  Is there a simpler
way to do it?  Am I nuts?  Does a bear poo in the woods?
Etc...etc...etc...

Many thanks for your kind attention,


Rich Stephens
Software Developer
Optio Software, Inc.
Windward Fairways II
3015 Windward Plaza
Alpharetta, GA 30005
(770) 576-3561
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to