serializing xml in java

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Uri

    #1

    serializing xml in java

    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?
  • Johannes Koch

    #2
    Re: serializing xml in java

    Uri wrote:[color=blue]
    > 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)?[/color]

    In DOM 3 Load and Save (which is a W3C recommendation since 07 April
    2004), there is a LSSerializer interface.
    --
    Johannes Koch
    In te domine speravi; non confundar in aeternum.
    (Te Deum, 4th cent.)

    Comment

    • Martin Honnen

      #3
      Re: serializing xml in java



      Uri wrote:

      [color=blue]
      > 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)?[/color]

      Sort of and a bit convoluted: you can use the default transformer
      created with
      javax.xml.trans form.Transforme rFactory.newTra nsformer()
      to serialize.


      --

      Martin Honnen
      http://JavaScript.FAQTs.com/

      Comment

      Working...