[jdom-interest] java.net.MalformedURLException

Elliotte Rusty Harold elharo at metalab.unc.edu
Tue Oct 7 17:53:06 PDT 2003


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 at metalab.unc.edu
   Processing XML with Java (Addison-Wesley, 2002)
   http://www.cafeconleche.org/books/xmljava
   http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA



More information about the jdom-interest mailing list