• 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

How to parse DOCTYPE node (URGENT)

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
</div>

When I parse the above document using SAXPARSER
parser,
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
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
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
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 ]
reply
    Bookmark Topic Watch Topic
  • New Topic