You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by rf <ru...@yahoo.com> on 2002/12/20 11:56:08 UTC

toString/serializer

What is the reason for not implementing a default
simple serializer for org.w3c.dom.Node.toString()?

Thank you
Rf.

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: toString/serializer

Posted by Joseph Kesselman <ke...@us.ibm.com>.
>What is the reason for not implementing a default
>simple serializer for org.w3c.dom.Node.toString()?

The DOM makes no promise that toString() works at all, so any behavior is 
acceptable. The question is just whether the current behavior is 
optimal... and I can argue that it is.

When I wrote the early prototype of the Xerces DOM, I wanted toString() to 
do _something_ simply for ease of debugging, so I implemented the minimal 
routines which (I think) are still present. But it wasn't intended to be a 
serializer... and in fact if you want a debugging printout, a serializer 
is generally the WRONG thing; usually, you just want to know what this 
node looks like, not what its contents look like. 

Even a "simple" serializer is a lot of code if you want to do a vaguely 
adequate job; take a look at the Xerces serializer classes. It probably 
wouldn't be a good thing to require that all users of the DOM carry that 
code around, or to run all that code every time someone wants a quick 
"what am I looking at" display.

If you want to serialize, call the serializer classes.


______________________________________
Joe Kesselman  / IBM Research


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org