• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dtd parsing error

 
Josweth Reddy
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,
Im new to JAXB and Im deploying a sample application to unmarshal from the xml document. While using the xjc command to generate the jaav code,facing an error saying that

"parsing a schema...[ERROR] The markup in the document preceding the root element must be well-formed."

The below is the dtd file
<!ELEMENT item_list (item_info*)>
<!ELEMENT item_info (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT price (#PCDATA)>

xjc command using
xjc item.dtd item.xjs

Please help me out to generate the java code by executing the xjc command.

Thanks in advance,
Josweth Reddy
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just glancing at the XJC documentation here it appears that xjc assumes all input files are schema so it is trying to parse your dtd as xml and fails giving you an XML parsing error.

Bill
 
Josweth Reddy
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill,

Thanks for the clarification. But I would like to develop a sample application using JAXB. Shall I go for the xsd file instead of dtd ?. Or else please tell me the alternate.

Thanks,
Josweth Reddy

 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a link to an article about the architecture of JAXB. Notice how it continually mentions schemas? Anyway, if you scan it for "DTD" you will find it has some advice for what to do about DTDs.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic