serializing xml in java

U

Uri

Hi,
I am using apaches' XMLSerializer to serialize a DOM Document
as an OutputStream. 2 questions:
1) Is there a standard way of serializing XML(without using a specific
parser)?
2) Should there be any difference between explicitly setting the
OutputFormat
with "UTF-8" encoding or not setting it at all? from what I read the
default is "UTF-8" anyway, and the only difference would be the
"encoding" directive in the xml declaration. However, I am getting
different behavior in each case regarding the stream format(But I'm
still not sure it's the serializer and not something else). Is this
possible?
 
J

Johannes Koch

Uri said:
I am using apaches' XMLSerializer to serialize a DOM Document
as an OutputStream. 2 questions:
1) Is there a standard way of serializing XML(without using a specific
parser)?

In DOM 3 Load and Save (which is a W3C recommendation since 07 April
2004), there is a LSSerializer interface.
 
M

Martin Honnen

Uri wrote:

I am using apaches' XMLSerializer to serialize a DOM Document
as an OutputStream. 2 questions:
1) Is there a standard way of serializing XML(without using a specific
parser)?

Sort of and a bit convoluted: you can use the default transformer
created with
javax.xml.transform.TransformerFactory.newTransformer()
to serialize.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top