Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

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

Edelson, Justin

2006-07-05


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@(protected)
Sent: Tuesday, July 04, 2006 9:25 AM
To: jdom-interest@(protected)
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);

hth

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.