}
public void insert(Node parent, CMNode cmnode, int index) {
Document document = parent.getNodeType() == Node.DOCUMENT_NODE ? (Document) parent : parent.getOwnerDocument();
DOMContentBuilder builder = createDOMContentBuilder(document);
builder.setBuildPolicy(DOMContentBuilder.BUILD_ONLY_REQUIRED_CONTENT);
builder.build(parent, cmnode);
insertNodesAtIndex(parent, builder.getResult(), index);
}