List of usage examples for org.w3c.dom Node getChildNodes
public NodeList getChildNodes();
NodeList
that contains all children of this node. From source file:Main.java
public static void removeChildren(Node e) { NodeList list = e.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node n = list.item(i);/*from ww w . j av a2 s. c o m*/ e.removeChild(n); } }
From source file:Main.java
private static String getValorNodo(Node nodo) { return nodo.getChildNodes().item(0).getNodeValue(); }
From source file:Main.java
public static boolean hasChildren(Node node) { return node != null && node.getChildNodes() != null && node.getChildNodes().getLength() > 0; }
From source file:Main.java
public static void removeChildren(Node node) { NodeList childNodes = node.getChildNodes(); int length = childNodes.getLength(); for (int i = length - 1; i > -1; i--) node.removeChild(childNodes.item(i)); }
From source file:Main.java
public static void removeChildren(Node node) { NodeList childNodes = node.getChildNodes(); int length = childNodes.getLength(); for (int i = length - 1; i > -1; i--) { node.removeChild(childNodes.item(i)); }/*www . j a va 2s . c om*/ }
From source file:Main.java
/** * Return array of children nodes/*from w w w . j a va2 s.c om*/ */ public static Node[] childrenArray(Node node) { NodeList list = node.getChildNodes(); Node[] children = new Node[list.getLength()]; for (int i = 0; i < children.length; i++) { children[i] = list.item(i); } return children; }
From source file:Main.java
public static String getFirstLevelTextContent(Node node) { NodeList list = node.getChildNodes(); StringBuilder textContent = new StringBuilder(); for (int i = 0; i < list.getLength(); ++i) { Node child = list.item(i); if (child.getNodeType() == Node.TEXT_NODE) textContent.append(child.getTextContent()); }/* w w w .j av a 2 s . c om*/ return textContent.toString().trim(); }
From source file:Main.java
public static String getNodeText(Node node) { NodeList fstNm = node.getChildNodes(); String ret = fstNm.item(0).getNodeValue(); return ret;/*from ww w . jav a 2 s. com*/ }
From source file:Main.java
public static Vector getSetColorNodes(Node node) { NodeList nList = node.getChildNodes(); Vector propertySetNodes = new Vector(); for (int i = 0; i < nList.getLength(); i++) { Node kidNode = nList.item(i); if (kidNode.getNodeName().equals("setColor")) { propertySetNodes.addElement(kidNode); }//from ww w . j a v a 2 s . c om } return propertySetNodes; }
From source file:Main.java
public static List<Node> getSubNodes(Node node) { NodeList nodeList = node.getChildNodes(); List<Node> nodes = new ArrayList<Node>(); for (int i = 0; i < nodeList.getLength(); i++) { nodes.add(nodeList.item(i));//from w w w .j a v a 2s . co m } return nodes; }