T
tony vee
Hi
I have the following bit of Java code:
Document doc = tidy.createEmptyDocument();
//bodyElement is the body element in an HTML Document
Node first = bodyElement.getFirstChild();
Node top = doc.getDocumentElement();
top.appendChild(first);
which produces unexpected results. Basically, all I am after is getting the
first child node of the body element and copy it to the new document. But
what I get is the required element AND every element after it - every one of
the first elements siblings! I have tried so many variations of the above,
using DocumentFragments etc, but with no joy. In order to preserve the
little hair I have left, I would be grateful for any help
Tony
I have the following bit of Java code:
Document doc = tidy.createEmptyDocument();
//bodyElement is the body element in an HTML Document
Node first = bodyElement.getFirstChild();
Node top = doc.getDocumentElement();
top.appendChild(first);
which produces unexpected results. Basically, all I am after is getting the
first child node of the body element and copy it to the new document. But
what I get is the required element AND every element after it - every one of
the first elements siblings! I have tried so many variations of the above,
using DocumentFragments etc, but with no joy. In order to preserve the
little hair I have left, I would be grateful for any help
Tony