T
tony vee
Hi
I have a number of element objects contained in a document object. I am
trying to extract some of these nodes from the document object, and add them
to a new DocumentFragment like so:
Element firstNode = document.getDocumentElement();
DocumentFragment docFrag = document.createDocumentFragment();
docFrag.appendChild(docFrag); //this line throws nullPointerException
but I get a null pointer exception, since docFrag is null. How do I
instantiate a docFrag in order to be able to append a child node to it?
Also, since I am mainly working with HTML files, is there a better API to
use other than the org.w3c.dom API, which is what I am using at the moment.
Thanks
Tony
I have a number of element objects contained in a document object. I am
trying to extract some of these nodes from the document object, and add them
to a new DocumentFragment like so:
Element firstNode = document.getDocumentElement();
DocumentFragment docFrag = document.createDocumentFragment();
docFrag.appendChild(docFrag); //this line throws nullPointerException
but I get a null pointer exception, since docFrag is null. How do I
instantiate a docFrag in order to be able to append a child node to it?
Also, since I am mainly working with HTML files, is there a better API to
use other than the org.w3c.dom API, which is what I am using at the moment.
Thanks
Tony