[jdom-interest] Error with JDom?

Jason Hunter jhunter at collab.net
Thu Mar 22 20:32:40 PST 2001

Sounds like the "Why does passing a document through a socket sometimes
hang the parser?" question in the faq, except this time the parser
complains instead of hanging.

Why are you using DOMBuilder?


Chad LaJoie wrote:
> I am currently using JDOM to parse external (to my system) RSS
> channels.  Every time I try to read one I get the following exception
> org.jdom.JDOMException: Error on line 1: The root element is required in a
> well-formed document.
>          at org.jdom.input.DOMBuilder.build(DOMBuilder.java:293)
>          at org.jdom.input.DOMBuilder.build(DOMBuilder.java:342)
>          at
> edu.vt.ward.lexus.widgets.RSSWidget.RSSParser.parse(RSSParser.java:108)
>          at
> edu.vt.ward.lexus.widgets.RSSWidget.RSSParser.updateChannel(RSSParser.java:65)
>          at
> edu.vt.ward.lexus.widgets.RSSWidget.RSSChannel.update(RSSChannel.java:543)
> Yet when I go and look at the actual RSS file (in this case
> http://cnn.com/cnn.rss) it's appears to be just fine.  Another gentlemen
> the works with me gets the same error when he tries to parse a file on the
> local system and again the document is well-formed and have been validated
> against the DTD.  Has anyone else encountered this and if so what am I
> missing here?
> For reference here is the code I am using to in my method where the
> exception is being encountered.
>          private RSSChannel parse(URL url) {
>                  try {
>                          DOMBuilder builder = new DOMBuilder();
>                          Document doc = builder.build(url);      //this is
> line 108
>                          Element root = doc.getRootElement();
>                          .......
>          }
> Chad La Joie                           "Only a man who can not conquer
> IT Specialist                             his deficiencies feels the need to
> IS&C - WARD                             convince the world he has none"
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

More information about the jdom-interest mailing list