• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Document: No DOCTYPE declaration, Root is [Element: <nodename/>]

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

It would be better if somebody helps me to resolve an issue I am facing while converting XML string into JDom Document object.

The XML string looks as

<?xml version="1.0" encoding="UTF-8"?>
<items>
<item>
<displayText>
</displayText>
<linkItem>
<link pageID="Person_homePagePage.do" modal="true">
<displayText>David</displayText>
<params>
<param name="id">10000</param>
</params>
</link>
</linkItem>
<displayText>is 30 years old.</displayText>
</item>
</items>

and java code looks as

org.jdom.Document document = null;
SAXBuilder builder = new SAXBuilder();

try {
document = builder.build(new StringReader(xmlString));
} catch (JDOMException e) {
//
} catch (IOException e) {
//
} catch (Exception e) {
//
}
return document;

in runtime I get error like [Document: No DOCTYPE declaration, Root is [Element: <items/>]]

Can somebody helps me what is the problem with the XML and how can I resolve this issue?

Thanks in advance.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What makes you think that's an error? If an exception were really being thrown, you wouldn't know what it was because your catch-blocks are all empty. (Don't do that, you need to know what the exception was). So where is that output coming from in your code?

(And when you post code, or XML, please post it inside the "code" tags which you can get by clicking the "Code" button above the box you're about to post in.)
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, there's no doctype; maybe you need one?
 
Think of how dumb the average person is. Mathematically, half of them are EVEN DUMBER. Smart tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic