xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] toXML() instead of getStringForm()?
- From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
- To: "Bradley S. Huffman" <hip AT a.cs.okstate.edu>
- Cc: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] toXML() instead of getStringForm()?
- Date: Fri, 20 Sep 2002 07:36:33 -0400
At 11:26 PM -0500 9/19/02, Bradley S. Huffman wrote:
Is there some reason people don't like toString() for this functionality.
Yes. If you invoke toXML on a Document or large Element, you're potentially getting a *lot* of text back in that string. That make sit inconvenient for the use-case of System.out.println(myObject) to see what the object is and what its properties are when debugging. Furthermore, you may have to do a potentially expensive tree-walk.
I'm not sure if Sun has ever officially stated this (and I know some of their own classes violate it) but I feel that toString() methods should be limited to one line of text that's fairly quick to generate, and that this line of text should include the class name.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo AT metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| XML in a Nutshell, 2nd Edition (O'Reilly, 2002) |
| http://www.cafeconleche.org/books/xian2/ |
| http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+
-
[XOM-interest] toXML() instead of getStringForm()?,
Elliotte Rusty Harold, 09/19/2002
-
Re: [XOM-interest] toXML() instead of getStringForm()?,
Bradley S. Huffman, 09/20/2002
- Re: [XOM-interest] toXML() instead of getStringForm()?, Elliotte Rusty Harold, 09/20/2002
-
Re: [XOM-interest] toXML() instead of getStringForm()?,
Kevin Herrboldt, 09/25/2002
- Re: [XOM-interest] toXML() instead of getStringForm()?, John Cowan, 09/25/2002
-
Re: [XOM-interest] toXML() instead of getStringForm()?,
Rolf Lohaus, 09/20/2002
- Re: [XOM-interest] toXML() instead of getStringForm()?, Elliotte Rusty Harold, 09/30/2002
-
Re: [XOM-interest] toXML() instead of getStringForm()?,
Laurent Bihanic, 09/20/2002
-
Re: [XOM-interest] toXML() instead of getStringForm()?,
John Cowan, 09/20/2002
-
Re: [XOM-interest] toXML() instead of getStringForm()?,
Laurent Bihanic, 09/20/2002
- Re: [XOM-interest] toXML() instead of getStringForm()?, John Cowan, 09/20/2002
- Re: [XOM-interest] toXML() instead of getStringForm()?, Elliotte Rusty Harold, 09/20/2002
-
Re: [XOM-interest] toXML() instead of getStringForm()?,
Laurent Bihanic, 09/20/2002
-
Re: [XOM-interest] toXML() instead of getStringForm()?,
John Cowan, 09/20/2002
-
Re: [XOM-interest] toXML() instead of getStringForm()?,
Bradley S. Huffman, 09/20/2002
Archive powered by MHonArc 2.6.24.