Java Mailing List Archive

http://www.junlu.com/

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

Re: [jdom-interest] java.net.MalformedURLException

Elliotte Rusty Harold

2003-10-07

Replies:

At 1:18 PM -0700 10/7/03, Fedor Smirnoff wrote:
Hi,

While:

      SAXBuilder builder = new SAXBuilder(false);
      Document doc = builder.build(bf.toString());

Where bf is a StringBuffer populated by readLine() from:

BufferedReader in = new BufferedReader(new
InputStreamReader((result.getDataStream())));

I get Java err: java.net.MalformedURLException: no protocol:


Read the JavaDoc. That constructor expects to receive a String
containing the URL of the document, not a String containing the
document itself. Pass the reader to the parse method without
converting it to a string first.
--

 Elliotte Rusty Harold
 elharo@(protected)
 Processing XML with Java (Addison-Wesley, 2002)
 http://www.cafeconleche.org/books/xmljava
 http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.