Translate DOM to SAX and vice versa

Discussion in 'Java' started by Aevi, Mar 26, 2008.

  1. Aevi

    Aevi Guest

    I want to convert a DOM node x and its descendants into a SAX stream
    and vice versa. has someone tried any of these two cases any help is
    appreciated.

    -Aevi
     
    Aevi, Mar 26, 2008
    #1
    1. Advertising

  2. Aevi

    Lew Guest

    Aevi wrote:
    > I want to convert a DOM node x and its descendants into a SAX stream
    > and vice versa. has someone tried any of these two cases any help is
    > appreciated.


    There really isn't any such thing as a SAX stream. There's an input Reader
    that a SAX parser pulls data from, then calls callbacks that you write. The
    closest thing to a SAX stream there is is an XML document.

    If you write well-formed XML from your DOM model to an output Writer, you
    could attach a Reader to the other end of it and use it as an XML InputSource.
    But how would that help? If you are generating the XML you already have it,
    and the data that it represents, so how does a SAX parser add value there?

    Can't you just pull the information directly from your DOM model to whatever
    needs it?

    --
    Lew
     
    Lew, Mar 27, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jimmy
    Replies:
    1
    Views:
    3,188
    Eliyahu Goldin
    Jun 14, 2005
  2. carmen
    Replies:
    4
    Views:
    30,818
    ersecchio
    Jan 12, 2010
  3. Sam Hwang

    Java Object to XML and vice versa

    Sam Hwang, Apr 24, 2005, in forum: Java
    Replies:
    5
    Views:
    1,040
    iksrazal
    Apr 25, 2005
  4. -
    Replies:
    8
    Views:
    641
    Antti S. Brax
    Jun 11, 2005
  5. Peter Otten
    Replies:
    1
    Views:
    170
    Andreas Perstinger
    Jun 18, 2013
Loading...

Share This Page