[jdom-interest] BUG? SAXBuilder build(String) method throws MalformedURLException

Elliotte Rusty Harold elharo at metalab.unc.edu
Fri Mar 14 14:34:38 PST 2003


At 12:56 PM -0500 3/14/03, Erik Earle wrote:
>With code:
><code>
>        XMLOutputter prettyOut = new XMLOutputter("  ",true);
>        String soap = "<foo></foo>";
>
>        try {
>            SAXBuilder sb = new SAXBuilder();
>            Document doc = sb.build(soap)

That constructor doesn't do what you think it does. The string 
argument is supposed to be a URL pointing to the document, not the 
document itself. Use a StringReader to do what you want.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|           Processing XML with Java (Addison-Wesley, 2002)          |
|              http://www.cafeconleche.org/books/xmljava             |
| http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA  |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list