[jdom-interest] Build from a string of XML

Pat Coulthard coulthar at cs.wisc.edu
Thu Aug 10 14:26:48 PDT 2000

Try using the java.io.StringReader class.

SAXBuilder builder = new SAXBuilder();
String parseString = ...
Document doc = builder.build(new StringReader(parseString));

This is the way that I'm doing it.
Hope this helps.


Pat Coulthard
Technical Specialist
Internet Scout Project
coulthar at cs.wisc.edu

>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:

More information about the jdom-interest mailing list