xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Luca Passani <passani AT eunet.no>
- To: xom-interest <xom-interest AT lists.ibiblio.org>
- Subject: Re: [XOM-interest] serializing XOM objects
- Date: Tue, 31 May 2005 12:34:45 +0200
Elliotte Harold wrote:
if you're concerned about size you wouldn't pretty print anything. If you're concerned about performance you'd use a Serializer rather than toXML.
I use this code to send my XML to the client. The pretty printer is useful for my debugging, but useless
in a production environment. If you can suggest ways to do this more efficient, please tell me, because I am very interested
public static void toPrettyXML(Document doc, OutputStream out, String encoding) throws Exception {
Serializer serializer = new Serializer(out, encoding);
serializer.setIndent(2);
serializer.setMaxLength(200);
serializer.setPreserveBaseURI(false);
serializer.write(doc);
serializer.flush();
out.close();
}
public static String toPrettyXML(Document doc, String encoding) throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
toPrettyXML(doc, out, encoding);
return out.toString();
}
I actually think you did not. I have given you a great use case of why serialization should be supported: platforms try to do it no matter if you want it or not. So, XOM should allow for that.is there some specific reason why XOM objects cannot be serialized?
Of course XOM objects can be serialized. They can be serialized as compact, interoperable, easy-to-use, easy-to-debug, easy-tread, easy-to-understand, robust XML. Now with if you want them serialized in an opaque, brittle, bulging, platform-specific binary format that breaks every time you add a field to a class...Hmm I think I just answered the question :-)
I agree that XML is in itself a serialization format, but to me the sensible choice is to let developers decide for themselves, rather than forcing them to live with restrictions.
....mmm.... I am perplexed here.There seems to be a moralistic tone in your approach to this issue...are you born and raised catholic?
Luca
-
[XOM-interest] serializing XOM objects,
Luca Passani, 05/31/2005
-
Message not available
-
Message not available
- Re: [XOM-interest] serializing XOM objects, Elliotte Harold, 05/31/2005
-
Message not available
-
Message not available
-
Message not available
-
Message not available
-
Message not available
-
Re: [XOM-interest] serializing XOM objects,
Luca Passani, 05/31/2005
-
Re: [XOM-interest] serializing XOM objects,
Elliotte Harold, 05/31/2005
-
RE: [XOM-interest] serializing XOM objects,
Michael Kay, 05/31/2005
- Re: [XOM-interest] serializing XOM objects, John Cowan, 05/31/2005
-
Re: [XOM-interest] serializing XOM objects,
Luca Passani, 05/31/2005
- Re: [XOM-interest] serializing XOM objects, Elliotte Harold, 05/31/2005
- Re: [XOM-interest] serializing XOM objects, Luca Passani, 05/31/2005
- Re: [XOM-interest] serializing XOM objects, Elliotte Harold, 05/31/2005
- Re: [XOM-interest] serializing XOM objects, Luca Passani, 05/31/2005
- Re: [XOM-interest] serializing XOM objects, Adam Constabaris, 05/31/2005
- Re: [XOM-interest] serializing XOM objects, Luca Passani, 05/31/2005
-
RE: [XOM-interest] serializing XOM objects,
Michael Kay, 05/31/2005
-
Re: [XOM-interest] serializing XOM objects,
Elliotte Harold, 05/31/2005
-
Re: [XOM-interest] serializing XOM objects,
Luca Passani, 05/31/2005
-
Message not available
-
Message not available
Archive powered by MHonArc 2.6.24.