[jdom-interest] Substituting a different <!DOCTYPE ...> when parsing an XML file

Geoff Rimmer geoff.rimmer at sillyfish.com
Tue Jun 4 10:08:30 PDT 2002


Elliotte Rusty Harold <elharo at metalab.unc.edu> writes:
>
> At 4:36 PM +0000 5/30/02, Geoff Rimmer wrote:
>
>> When parsing XML files with validation switched on, I think that in
>> 95% of cases, it should be the *application* rather than the XML
>> file that specifies which DTD file to validate against.
>
> Basically I agree with you. Unfortunately, XML is designed in the
> opposite fashion. Doing what you suggest is pretty much
> nonconformant with the XML 1.0 specification. :-(
>
> Schemas do fix this, and explicitly allow you to validate against a
> schema of your choice which is not necessarily the one referenced by
> the document.

I knew I'd put off learning Schemas for way too long :)

Having looked into it now, this is definitely the way to go.  I've now
got code that uses JDOM to parse XML documents using Xerces and
validating against my .xsd files.  Fantastic stuff.

-- 
Geoff Rimmer <> geoff.rimmer at sillyfish.com <> www.sillyfish.com
www.sillyfish.com/phone - Make savings on your BT and Telewest phone calls
UPDATED 09/05/2002: 508 destinations, 12 schemes (with contact details)



More information about the jdom-interest mailing list