[jdom-interest] How to create a JDOM document from a String

Edelson, Justin Justin.Edelson at mtvn.com
Wed Jul 5 06:58:11 PDT 2006

You need to use a java.io.StringReader:

SAXBuilder sb = new SAXBuilder();
Document doc = sb.build(new StringReader(string);

The code below will try to resolve the string as a URI. It doesn't sound like that's what you want.

-----Original Message-----
From: jdom-interest-bounces at jdom.org [mailto:jdom-interest-bounces at jdom.org] On Behalf Of jmt
Sent: Tuesday, July 04, 2006 9:25 AM
To: jdom-interest at jdom.org
Subject: Re: [jdom-interest] How to create a JDOM document from a String

On Tuesday 04 July 2006 13:53, Søren Faltz wrote:
> I have a string that i got from a JMS queue.
> How do i convert this String into a JDOM document???
> thanx guys :)
> Søren

use a SAXBuilder :

SAXBuilder sb=new SAXBuilder();

Document doc=sb.build(string);


To control your jdom-interest membership:

More information about the jdom-interest mailing list