java - Why DocumentBuilder.parse throws SaxParserException -


the typical code snippet create dom xml below:

document dom = documentbuilderfactory.newinstance().newdocumentbuilder().parse("somefile.xml"); 

i wondering why parse method throws saxexception ?

i looked code , found domparser class parse(inputsource inputsource) method throws exception chain.

can please me understand, why dom creation need catch saxexception ? isn't kind of oximoron?

because internally uses sax apis.

note class reuses several classes sax api. not require implementor of underlying dom implementation use sax parser parse xml document document. merely requires implementation communicate application using these existing apis.

http://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/documentbuilder.html


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -