Java Code Examples for org.w3c.dom.Document#ELEMENT_NODE
The following examples show how to use
org.w3c.dom.Document#ELEMENT_NODE .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: pixate-freestyle-android File: PXDOMStyleAdapter.java License: Apache License 2.0 | 6 votes |
private Object getSiblingAt(Node node, int offset, boolean skipNonElement) { Object result = null; int indexInParent = getIndexInParent(node); if (indexInParent != -1) { int siblingIndex = indexInParent + offset; NodeList siblings = node.getParentNode().getChildNodes(); // Get the sibling at the offset. In case it's out of // bounds, return null. while (result == null) { if (siblingIndex >= 0 && siblingIndex < siblings.getLength()) { Node sibling = siblings.item(siblingIndex); if (skipNonElement && sibling.getNodeType() != Document.ELEMENT_NODE) { // skip the non-element node siblingIndex += (offset < 0) ? -1 : 1; } else { result = sibling; break; } } else { // out of bounds break; } } } return result; }
Example 2
Source Project: feeyo-hlsserver File: ConfigLoader.java License: Apache License 2.0 | 5 votes |
@SuppressWarnings("unused") private static List<Node> getChildNodes(Node theNode, String childElName) { LinkedList<Node> nodes = new LinkedList<Node>(); NodeList childs = theNode.getChildNodes(); for (int j = 0; j < childs.getLength(); j++) { if (childs.item(j).getNodeType() == Document.ELEMENT_NODE && childs.item(j).getNodeName().equals(childElName)) { nodes.add(childs.item(j)); } } return nodes; }
Example 3
Source Project: feeyo-redisproxy File: AbstractConfigLoader.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
protected static List<Node> getChildNodes(Node theNode, String childElName) { LinkedList<Node> nodes = new LinkedList<Node>(); NodeList childs = theNode.getChildNodes(); for (int j = 0; j < childs.getLength(); j++) { if (childs.item(j).getNodeType() == Document.ELEMENT_NODE && childs.item(j).getNodeName().equals(childElName)) { nodes.add(childs.item(j)); } } return nodes; }
Example 4
Source Project: feeyo-redisproxy File: KafkaConfigLoader.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
static List<Node> getChildNodes(Node theNode, String childElName) { LinkedList<Node> nodes = new LinkedList<Node>(); NodeList childs = theNode.getChildNodes(); for (int j = 0; j < childs.getLength(); j++) { if (childs.item(j).getNodeType() == Document.ELEMENT_NODE && childs.item(j).getNodeName().equals(childElName)) { nodes.add(childs.item(j)); } } return nodes; }
Example 5
Source Project: secure-data-service File: MergeDocuments.java License: Apache License 2.0 | 5 votes |
/** * Adds the nodes in actionArgs as children nodes to editNode. * * @param editNode The node on which children will be added. * @param actionArgs The nodes to add. */ private void nodeAdd(Node editNode, NodeList actionArgs) { // got through and add each new node to the root for (int k = 0; k < actionArgs.getLength(); k++) { Node n = actionArgs.item(k); if (n.getNodeType() == Document.ELEMENT_NODE) { editNode.appendChild(editNode.getOwnerDocument().adoptNode(n.cloneNode(true))); } } }