[jdom-interest] Build from a string of XML

Jason Hunter jhunter at acm.org
Thu Aug 10 13:21:13 PDT 2000


You can build from a String using normal Java classes.  I used that
technique in the jdom-contrib XPath example.

String doc = "...";
Document d = new SAXBuilder().build(new StringReader(doc));

-jh-

Vince Webb 3rd Flr GSS wrote:
> 
> I'm new to JDOM and new to XML.
> So far I have got as far as running PrettyPrint
> from JavaWorld and it works OK.
> 
> I want to write an application that repeatedly
> goes through the following sequence:
> 
> 1) receive XML given to me as a java String by a comms API
> 2) build java objects
> 3) wade through the objects using the data to update a database
> 
> I've looked at
> org.jdom.input.SAXBuilder.build(various options here)
> I don't see how to build from a String other than
> writing the XML to a file and then getting JDOM
> to read the file.
> 
> Any ideas ?
> 
> Regards ........ Vince
> 
> -----------------------------------------------------------------
>         Visit our Internet site at http://www.reuters.com
> 
> Any views expressed in this message are those of  the  individual
> sender,  except  where  the sender specifically states them to be
> the views of Reuters Ltd.
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list