[jdom-interest] JDOM SaxBuilder Error

David.Blatchford at usa.alcatel.com David.Blatchford at usa.alcatel.com
Wed May 30 08:34:23 PDT 2001

I am relatively new to JDOM, and have run into a problem using the
SAXBuilder class. I have an XML file (base.xml) which references an
external entity, that is another XML file (ext.xml) . In my java class I am
trying to build a Document using the SAXBuilder class. I am passing in a
FileInputStream(the base.xml file) to the build() method of the SAXBuilder
class and then try to do some accessing of elements afterwards. However,
when I try to run the program I get the following:

org.jdom.JDOMException: Error in building: null
     at org.jdom.input.SAXBuilder.build(SAXBuilder.java:411)
     at org.jdom.input.SAXBuilder.build(SAXBuilder.java:428)
     at myfile.init(myfile.java:55)
     at myfile.main(myfile.java:653)
Root cause: java.lang.NullPointerException
     at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:917)
     at org.jdom.input.SAXBuilder.build(SAXBuilder.java:395)
     at org.jdom.input.SAXBuilder.build(SAXBuilder.java:428)
     at myfile.init(myfile.java:55)
JDOMException caught: org.jdom.JDOMException: Error in building: null
     at myfile.main(myfile.java:653)
Exception in thread "main"

I have validated the base.xml file using XMLSpy, and get no errors. The DTD
in base.xml contains definitions for everything that is found in ext.xml.
So why is SAXBuilder, or the Xerces parser, having problems parsing my
file? Any help would be great.


More information about the jdom-interest mailing list