void getElementsByTagNameNS(NodeListImpl out, String namespaceURI, String localName) { for (NodeImpl node : children) { if (node.getNodeType() == Node.ELEMENT_NODE) { ElementImpl element = (ElementImpl) node; if (matchesNameOrWildcard(namespaceURI, element.getNamespaceURI()) && matchesNameOrWildcard(localName, element.getLocalName())) { out.add(element); } element.getElementsByTagNameNS(out, namespaceURI, localName); } } }
void getElementsByTagName(NodeListImpl out, String name) { for (NodeImpl node : children) { if (node.getNodeType() == Node.ELEMENT_NODE) { ElementImpl element = (ElementImpl) node; if (matchesNameOrWildcard(name, element.getNodeName())) { out.add(element); } element.getElementsByTagName(out, name); } } }
public void normalizeDocument() { Element root = getDocumentElement(); if (root == null) { return; } ((DOMConfigurationImpl) getDomConfig()).normalize(root); }
public final Text splitText(int offset) throws DOMException { Text newText = document.createTextNode( substringData(offset, getLength() - offset)); deleteData(0, offset); Node refNode = getNextSibling(); if (refNode == null) { getParentNode().appendChild(newText); } else { getParentNode().insertBefore(newText, refNode); } return this; }
/** * Replaces this node with a semantically equivalent text node. This node * will be removed from the DOM tree and the new node inserted in its place. * * @return the replacement node. */ public TextImpl replaceWithText() { TextImpl replacement = new TextImpl(document, getData()); parent.insertBefore(replacement, this); parent.removeChild(this); return replacement; } }
public void setAttribute(String name, String value) throws DOMException { Attr attr = getAttributeNode(name); if (attr == null) { attr = document.createAttribute(name); setAttributeNode(attr); } attr.setValue(value); }
public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException { Attr attr = getAttributeNodeNS(namespaceURI, qualifiedName); if (attr == null) { attr = document.createAttributeNS(namespaceURI, qualifiedName); setAttributeNodeNS(attr); } attr.setValue(value); }
void getTextContent(StringBuilder buf) throws DOMException { Node child = getFirstChild(); while (child != null) { if (hasTextContent(child)) { ((NodeImpl) child).getTextContent(buf); } child = child.getNextSibling(); } }
public NodeList getElementsByTagName(String name) { NodeListImpl result = new NodeListImpl(); getElementsByTagName(result, name); return result; }
public NodeList getElementsByTagNameNS(String namespaceURI, String localName) { NodeListImpl result = new NodeListImpl(); getElementsByTagNameNS(result, namespaceURI, localName); return result; }
public NodeList getElementsByTagNameNS(String namespaceURI, String localName) { NodeListImpl result = new NodeListImpl(); getElementsByTagNameNS(result, namespaceURI, localName); return result; }
public NodeList getElementsByTagName(String name) { NodeListImpl result = new NodeListImpl(); getElementsByTagName(result, name); return result; }
public Element getElementById(String elementId) { ElementImpl root = (ElementImpl) getDocumentElement(); return (root == null ? null : root.getElementById(elementId)); }
/** * Removes {@code oldChild} and adds {@code newChild} in its place. This * is not atomic. */ public Node replaceChild(Node newChild, Node oldChild) throws DOMException { int index = ((LeafNodeImpl) oldChild).index; removeChild(oldChild); insertChildAt(newChild, index); return oldChild; }
public NodeList getChildNodes() { NodeListImpl list = new NodeListImpl(); for (NodeImpl node : children) { list.add(node); } return list; }
/** * Requests the singleton instance of the class. Creates it first, if * necessary. * * @return The singleton Android DOMImplementationImpl instance. */ public static DOMImplementationImpl getInstance() { if (instance == null) { instance = new DOMImplementationImpl(); } return instance; }
public DOMConfiguration getDomConfig() { if (domConfiguration == null) { domConfiguration = new DOMConfigurationImpl(); } return domConfiguration; }
@Override public String getNodeValue() { return getValue(); }
@Override public void setPrefix(String prefix) { this.prefix = validatePrefix(prefix, namespaceAware, namespaceURI); }