[jdom-interest] org.jdom.JDOMException

Philip Nelson panmanphil at yahoo.com
Wed Nov 13 09:42:37 PST 2002


You are telling DOMBuilder to validate and you don't have a dtd.  

1 - use SaxBuilder instead, it's much faster
2 - don't validate unless you have a dtd.  You still validate that the document
is well formed, even with validate set to false, because that's just the way
xml is ;-)

--- Stefanos Kaklamanis <stefka at gnt.gr> wrote:
> Hi,
> 
> I'm POSTing an xml-jdom document (through an application) to a servlet, that
> it reads the stream (using the request.getReader). Then, it creates another
> xml doc kai POST it back (using XMLOutputter).
> 
> The problem i have is when the application is trying to build the xml
> document from the response stream. 
> DOMBuilder builder = new DOMBuilder(true);
> outDoc = builder.build(conn.getInputStream());        <---------
> 
> I take the following error:
> 
> org.jdom.JDOMException: Error on line 2 of XML document: Element type "books"
> must be declared.
> 
> the repsonse xml is the following:
> <?xml version="1.0" encoding="UTF-8"?>
> <books>
>  <book isbn="123">
>   <title>Web Servers for Fun and Profit</title>
>   <quantity>10</quantity>
>   <price>$17.95</price>
>  </book>
>  <book isbn="456">
>   <title>Web Programming for Mobile Devices</title>
>   <quantity>2</quantity>
>   <price>$38.95</price>
>  </book>
> </books>
> 
> 
> Any idea?
> 
> 
> 
> Thanks
> 
> Stef
> 
> 


__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2



More information about the jdom-interest mailing list