You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Roytman, Alex" <ro...@peacetech.com> on 2001/03/09 04:30:28 UTC
NullPointer Exception while transforming to DOM
Following code will cause NullPointer exception
DOMResult result = new DOMResult(domFactory.createDocumentFragment());
TransformerHandler ch = transformerFactory.newTransformerHandler();
ch.setResult(result);
ch.startElement(null, null, "qname", new
org.xml.sax.helpers.AttributesImpl());
ch.endElement(null, null, "qname");
Adding startDocument/endDocument solves the problem:
ch.startDocument();
ch.startElement(null, null, "qname", new
org.xml.sax.helpers.AttributesImpl());
ch.endElement(null, null, "qname");
ch.endDocument();
but I do not think we should do it - transformer
should be able to serialize document fragment should it?