Hi
I have the following bit of Java code:
Document doc = tidy.createEmpt yDocument();
//bodyElement is the body element in an HTML Document
Node first = bodyElement.get FirstChild();
Node top = doc.getDocument Element();
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 DocumentFragmen ts 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.createEmpt yDocument();
//bodyElement is the body element in an HTML Document
Node first = bodyElement.get FirstChild();
Node top = doc.getDocument Element();
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 DocumentFragmen ts etc, but with no joy. In order to preserve the
little hair I have left, I would be grateful for any help
Tony