protected Object createNode(final String name) { final Element element = documentFactory.createElement(encodeNode(name)); final Branch top = top(); if (top != null) { top().add(element); } return element; }
public static org.w3c.dom.Node appendChild(Node node, org.w3c.dom.Node newChild) throws DOMException { if (node instanceof Branch) { Branch branch = (Branch) node; org.w3c.dom.Node previousParent = newChild.getParentNode(); if (previousParent != null) { previousParent.removeChild(newChild); } branch.add((Node) newChild); return newChild; } throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Children not allowed for this node: " + node); }
public static org.w3c.dom.Node insertBefore(Node node, org.w3c.dom.Node newChild, org.w3c.dom.Node refChild) throws DOMException { if (node instanceof Branch) { assert newChild instanceof Node; Branch branch = (Branch) node; List<Node> list = branch.content(); int index = list.indexOf(refChild); if (index < 0) { branch.add((Node) newChild); } else { list.add(index, (Node) newChild); } return newChild; } else { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Children not allowed for this node: " + node); } }
public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes attributes) throws SAXException { if (mergeAdjacentText && textInTextBuffer) { completeCurrentTextNode(); } QName qName = namespaceStack.getQName(namespaceURI, localName, qualifiedName); Branch branch = currentElement; if (branch == null) { branch = (org.dom4j.Document)getDocument(); } Element element = new DOMElement(qName); branch.add(element); // add all declared namespaces addDeclaredNamespaces(element); // now lets add all attribute values addAttributes(element, attributes); elementStack.pushElement(element); currentElement = element; }
public void addChildNode(Node node, Node newNode) { if (null == node || null == newNode) { log.warn("node to be added or add is null, operation skip!"); } else if (node instanceof Branch) { ((Branch) node).add(newNode); } else { log.warn("The node is a leaf, could not append child , operation skip!"); } }
public static org.w3c.dom.Node appendChild(Node node, org.w3c.dom.Node newChild) throws DOMException { if (node instanceof Branch) { Branch branch = (Branch) node; org.w3c.dom.Node previousParent = newChild.getParentNode(); if (previousParent != null) { previousParent.removeChild(newChild); } branch.add((Node) newChild); return newChild; } throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Children not allowed for this node: " + node); }
public static org.w3c.dom.Node appendChild(Node node, org.w3c.dom.Node newChild) throws DOMException { if (node instanceof Branch) { Branch branch = (Branch) node; org.w3c.dom.Node previousParent = newChild.getParentNode(); if (previousParent != null) { previousParent.removeChild(newChild); } branch.add((Node) newChild); return newChild; } throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Children not allowed for this node: " + node); }
public static org.w3c.dom.Node appendChild(Node node, org.w3c.dom.Node newChild) throws DOMException { if (node instanceof Branch) { Branch branch = (Branch) node; org.w3c.dom.Node previousParent = newChild.getParentNode(); if (previousParent != null) { previousParent.removeChild(newChild); } branch.add((Node) newChild); return newChild; } throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Children not allowed for this node: " + node); }
public static org.w3c.dom.Node appendChild(Node node, org.w3c.dom.Node newChild) throws DOMException { if (node instanceof Branch) { Branch branch = (Branch) node; org.w3c.dom.Node previousParent = newChild.getParentNode(); if (previousParent != null) { previousParent.removeChild(newChild); } branch.add((Node) newChild); return newChild; } throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Children not allowed for this node: " + node); }
public static org.w3c.dom.Node appendChild(Node node, org.w3c.dom.Node newChild) throws DOMException { if (node instanceof Branch) { Branch branch = (Branch) node; org.w3c.dom.Node previousParent = newChild.getParentNode(); if (previousParent != null) { previousParent.removeChild(newChild); } branch.add((Node) newChild); return newChild; } throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Children not allowed for this node: " + node); }
public static org.w3c.dom.Node appendChild(Node node, org.w3c.dom.Node newChild) throws DOMException { if (node instanceof Branch) { Branch branch = (Branch) node; org.w3c.dom.Node previousParent = newChild.getParentNode(); if (previousParent != null) { previousParent.removeChild(newChild); } branch.add((Node) newChild); return newChild; } throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Children not allowed for this node: " + node); }
@Override protected Element createNode(final String name) { final Element element = documentFactory.createElement(encodeNode(name)); final Branch top = top(); if (top != null) { top().add(element); } return element; }
protected Object createNode(final String name) { final Element element = documentFactory.createElement(escapeXmlName(name)); final Branch top = top(); if (top != null) { top().add(element); } return element; }
protected Object createNode(final String name) { final Element element = documentFactory.createElement(escapeXmlName(name)); final Branch top = top(); if (top != null) { top().add(element); } return element; }
protected Object createNode(final String name) { final Element element = documentFactory.createElement(encodeNode(name)); final Branch top = top(); if (top != null) { top().add(element); } return element; }
protected Object createNode(final String name) { final Element element = documentFactory.createElement(encodeNode(name)); final Branch top = top(); if (top != null) { top().add(element); } return element; }
protected Object createNode(final String name) { final Element element = documentFactory.createElement(encodeNode(name)); final Branch top = top(); if (top != null) { top().add(element); } return element; }
protected Object createNode(final String name) { final Element element = documentFactory.createElement(encodeNode(name)); final Branch top = top(); if (top != null) { top().add(element); } return element; }
protected Object createNode(final String name) { final Element element = documentFactory.createElement(encodeNode(name)); final Branch top = top(); if (top != null) { top().add(element); } return element; }
protected Object createNode(final String name) { final Element element = documentFactory.createElement(escapeXmlName(name)); final Branch top = top(); if (top != null) { top().add(element); } return element; }