[jdom-interest] basic xml/jdom questions...

Peter Smith shmooth at yahoo.com
Mon Jul 21 05:39:34 PDT 2003


What are the major API's I can use for XML parsing?
  * JDOM
  * DOM4J
   ???


Chapter 14 of the 'Processing XML with Java' book
says:
"It (JDOM) cannot check a Document object against a
schema or a DTD."
What exactly does this statement mean if JDOM can, in
fact, generate an exception when reading a
non-wellformed or invalid document?


I read in that same book that the author (??) is
working on a patch to to be able to differentiate
between well-formedness exceptions and validity
exceptions.  Is this true, and if so, is it done?


I have received some xml files which I have to
validate, parse, etc.  They do not have 'doctype' tags
in them, but I know which dtd they're supposed to
conform to.  Is it possible, with JDOM, to validate
these xml files against my dtd even though they don't
contain a DOCTYPE reference?

    e.g.  <!DOCTYPE chapter SYSTEM "docbookx.dtd">


I will be pulling out sections of xml files
(individual transactions) and validating each
individual transaction against a separate dtd -
depending on the type of transaction.  At least,
that's what I gather I'm going to have to do.  Does
this scenario make sense?  I was under the impression
that an xml file, once validated by a dtd, was valid -
which means that everything in that xml file was
valid.  Could there be another, more detailed level,
of validation that might occur?


Is it possible to validate a String of XML against a
DTD, at all, or with JDOM?


When sending xml files to another system/party, is it
customary to use a well-known URL for the DOCTYPE
command/instruction, or a simple one, or is it
customary to include one at all - especially if the
file naming convention implies the DTD type?
    e.g.  <!DOCTYPE chapter SYSTEM "docbookx.dtd">
                 vs.
    e.g.  <!DOCTYPE chapter SYSTEM
"http://www.foo.com/docbookx.dtd">


I noticed my command-line Java program was unable to
load/validate an XML file because, due to
firewall/proxy issues, it was unable to load a DTD
referenced on the web, where the DOCTYPE URL pointed. 
Of course, I'd rather use a local copy of the DTD. 
Can I force JDOM to use a local copy of a DTD?


Is a DTD supposed to be well-formed?


Is there such a thing as a 'valid' DTD, as opposed to
just 'well-formed'?


Thanks so much!



=====
/*****************************************************
 *  Mr. Kucinich is 'the only candidate for President 
 *  who will take this country away from fear and 
 *  war and tax giveaways...'.
 *
 *  http://www.costofwar.com/
 *  http://kucinich2004.meetup.com/
 *  http://www.kucinich.us/
 */

--Peter--



More information about the jdom-interest mailing list