wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes dtd parsing  error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "dtd parsing  error" Watch "dtd parsing  error" New topic
Author

dtd parsing error

Josweth Reddy
Ranch Hand

Joined: Nov 02, 2005
Posts: 30
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

Joined: Mar 22, 2000
Posts: 12761
    
    5
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

Joined: Nov 02, 2005
Posts: 30
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dtd parsing error
 
Similar Threads
question on mock exam
parsing error with XML DTD, help!
DTD for this XML
question on mock exam
validating against a DTD