File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Validating parser with no DOCTYPE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Validating parser with no DOCTYPE" Watch "Validating parser with no DOCTYPE" New topic

Validating parser with no DOCTYPE

Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Is there a way to create a validating SAX parser for a document that doesn't have a DOCTYPE in it? I'm using Xerces, so any non-standard way of doing this may work for me, too. Thanks.
[ April 27, 2005: Message edited by: Nathaniel Stoddard ]

Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
In the little time I could muster, I read about this (in XML Bible & the Spec.) and I am not very convinced that you could do this.

Part of the DOCTYPE declaration is that you declare the root element. You don't have to declare the DTD. That you can just provide a URL and get away with. As far as the root element, if all of your XML files have the same root element, then maybe this is possible. I have some doubts that this is the case you are trying to solve.

My wish: I wish I had the time to just write up some sample XML files and try a few things, but well I am struggling to juggle things between work, life and the other.

Sorry if it sounds like I am venting, I wish I had a more concrete answer.

- m

Take a Minute, Donate an Hour, Change a Life
I agree. Here's the link:
subject: Validating parser with no DOCTYPE
It's not a secret anymore!