jQuery in Action, 3rd edition
The moose likes XML and Related Technologies and the fly likes How to parse DOCTYPE node (URGENT) 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 "How to parse DOCTYPE node (URGENT)" Watch "How to parse DOCTYPE node (URGENT)" New topic

How to parse DOCTYPE node (URGENT)

Vipsha Sharma

Joined: Oct 18, 2007
Posts: 5
I have the following XML document

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE div PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<div id="title_block">
<span class="Title_bold">Update Account</span>

When I parse the above document using SAXPARSER
it reads just the first line of the document(i.e. xml version etc). But if
I remove DOCTYPE statement, it parse the whole document.

Will anybody please help me how to parse DOCTYPE node

Thanks in advance
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
First, EaseUp. Putting URGENT in the title will reduce the chance of getting a useful, quick answer.

Your XML, as posted, does not seem to be readable. My quick test was to try to get Internet Exploder to display it, and it won't.

Also, the URL http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd produces a "forbidden" response, if entered into a Web browser.

Maybe the problems, therefore, are not with your parsing, but with the XML itself.

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

If I'm not mistaken, that XHTML DTD requires the document to have an <html> element as its root element. Yours doesn't and therefore it's not valid. I expect the SAX parser threw an exception that you didn't notice (or ignored).

Edit: actually Peter is correct about your DTD. The correct DTD for XHTML transitional isWhich is not what you have. My comments were about this DTD.
[ October 31, 2007: Message edited by: Paul Clapham ]
I agree. Here's the link: http://aspose.com/file-tools
subject: How to parse DOCTYPE node (URGENT)
It's not a secret anymore!