[jdom-interest] Building Dom document from a string.

Jason Hunter jhunter at servlets.com
Mon Jul 1 11:57:58 PDT 2002


Hmm, I'm a little confused about what you're really trying to do.  You
say you have a DOM tree.  So pass the DOM Document to DOMBuilder and
you'll get a JDOM version of it.  But you say you have a String.  In
that case wrap it with a StringReader, pass the reader to SAXBuilder,
and build a JDOM document from the string.  If you want to go straight
from a String to a DOM, then use DOM and not JDOM.  Or build a JDOM from
the string, manipulate it, and then use DOMOutputter to output as a DOM.

-jh-

> "Grinvald, Edward" wrote:
> 
> Hi,
>         StringReader is what I would use in DOM with Xerces, but JDOM
> doesn't have a DOMBuilder build method that takes a reader.
> 
> Also, I know that performance of DOMBuilder is horrible, but I need to
> modify a dom tree (append/delete nodes), is there a way to wrap the
> SAXBuilder?
> 
> Thank You,
> 
> Edward Grinvald
> Computer Associates International
> Programmer, Storage Development
> Edward.Grinvald at ca.com
> 1-631-342-6000 x76350
> 
> -----Original Message-----
> From: Jason Hunter [mailto:jhunter at servlets.com]
> Sent: Saturday, June 29, 2002 10:57 AM
> To: Grinvald, Edward
> Cc: jdom-interest at jdom.org
> Subject: Re: [jdom-interest] Building Dom document from a string.
> 
> StringReader.
> 
> -jh-
> 
> > "Grinvald, Edward" wrote:
> >
> > Hi all,
> >     I have a small question:
> >     How do i build a document using DOMBuilder from a string that
> > contains my xml document. I'm not sure how to do this since the
> > StringBufferInputStream is deprecated.
> >
> > Thank You,
> >
> > Edward Grinvald
> > Computer Associates International
> > Programmer, Storage Development
> > Edward.Grinvald at ca.com
> > 1-631-342-6000 x76350
> >



More information about the jdom-interest mailing list