Getting document as null [#document: null] After parsing XML in java using DocumentBuilder Getting document as null [#document: null] After parsing XML in java using DocumentBuilder xml xml

Getting document as null [#document: null] After parsing XML in java using DocumentBuilder


[#document: null] is just the toString of your doc instance, it doesn't output your whole XML document.

The instance itself is not null, you can probably continue your processing without a problem.


you should add the static modifier to your Document object, I had the same problem and after the parsing action all non-static objects were simply referring to null. Making it static somehow forces java to keep the reference to the created object during the parse action in your variable.