Element root = doc.getDocumentElement().getFirstChild().asElement(); Node from = root.getLastChild(); doc.moveSiblings(Point.start(doc, root), from, null); assertOperationResult("<root><from/><before/></root>"); Node stuff = root.getFirstChild().getNextSibling(); from = stuff.getNextSibling(); doc.moveSiblings(Point.before(doc, stuff), from, root.getLastChild()); assertOperationResult( "<root><before/><from> child <sub/></from> more <attr x=\"x\" y=\"z\"/> stuff end</root>"); doc.moveSiblings(Point.end((Node) root), root.getFirstChild(), root.getLastChild()); assertOperationResult("<?a \"s\"=\"S\"?><root><?a \"e\"=\"E\" \"s\"?><after/>" + "<?a \"b\"=\"B\" \"e\" \"s\"=\"S\"?><b>b<?a \"s\"?>o<?a \"i\"=\"I\"?><i>ld"
Element root = doc.getDocumentElement().getFirstChild().asElement(); Node from = root.getLastChild(); doc.moveSiblings(Point.start(doc, root), from, null); assertOperationResult("<root><from/><before/></root>"); Node stuff = root.getFirstChild().getNextSibling(); from = stuff.getNextSibling(); doc.moveSiblings(Point.before(doc, stuff), from, root.getLastChild()); assertOperationResult( "<root><before/><from> child <sub/></from> more <attr x=\"x\" y=\"z\"/> stuff end</root>"); doc.moveSiblings(Point.end((Node) root), root.getFirstChild(), root.getLastChild()); assertOperationResult("<?a \"s\"=\"S\"?><root><?a \"e\"=\"E\" \"s\"?><after/>" + "<?a \"b\"=\"B\" \"e\" \"s\"=\"S\"?><b>b<?a \"s\"?>o<?a \"i\"=\"I\"?><i>ld"