[jdom-interest] [Fwd: More explicit Exceptions ?]
Christophe D. Laprun
chris.laprun at nist.gov
Fri Jun 23 14:22:51 PDT 2000
"Christophe D. Laprun" wrote:
>
> Hi all,
>
> I am pretty new to both JDOM and XML so bear with me if my question has
> already been asked...
> When JDOM reports an exception as in "org.jdom.JDOMException: Error on
> line 18 of XML document", would it be possible to specify the name of
> the XML document ? I am using several DTDs at the same time and it is
> not obvious which one of them triggered the Exception...
>
> Thanks a lot.
>
> Chris
After having taken a closer look at the code of SAXBuilder.build (which
created the exception when using SAXBuilderDemo), it seems that adding
the file name could be done using the getSystemId method of
org.sax.xml.InputSource and modify the code of
SAXBuilder.build(InputSource) (starting line 227):
throw new JDOMException(e.getMessage(),
new JDOMException("Error on line " +
p.getLineNumber() +
" of XML document: " +
p.getMessage()));
by something like:
throw new JDOMException(e.getMessage(),
new JDOMException("Error on line " +
p.getLineNumber() +
" of XML document " +
in.getSystemId() + ": " + p.getMessage()));
I guess there are other places where the modification would make sense
too.
What do you think ?
Thanks.
Chris
--
Christophe Laprun [Ingenieur ISIMA, France / Guest researcher @NIST]
web: http://www.nist.gov/speech/laprunch.htm
email: chris.laprun at nist.gov
phone: (301) 975 3191 fax: (301) 670 0939
--
The universe seems neither benign nor hostile, merely indifferent -
Sagan
More information about the jdom-interest
mailing list