Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Translate DOM to SAX and vice versa

Reply
Thread Tools

Translate DOM to SAX and vice versa

 
 
Aevi
Guest
Posts: n/a
 
      03-26-2008
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
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      03-27-2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
converting int and short to byte array and vice versa carmen Java 4 01-12-2010 05:00 PM
Howto display an ASP.net datagrid rows as columns and vice versa? Jimmy ASP .Net 1 06-14-2005 03:30 PM
How to convert '1' into '-1' and vice versa? - Java 8 06-11-2005 09:28 AM
Java Object to XML and vice versa Sam Hwang Java 5 04-25-2005 12:22 PM
map XML union to C union (and vice-versa) Matt Garman XML 1 04-25-2004 12:40 AM



Advertisments