List of usage examples for org.w3c.dom Node getNodeName
public String getNodeName();
From source file:Main.java
public static Node getChildNodeByName(Node node, String childName) { NodeList children = node.getChildNodes(); for (int j = 0; j < children.getLength(); j++) { Node child = children.item(j); if (child.getNodeName().equals(childName)) { return child; }/* w w w.jav a 2 s. co m*/ } return null; }
From source file:Main.java
protected static Node getNodeFromNodeList(NodeList list, String name) { for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); if (node.getNodeName().equals(name)) { return node; }// ww w. ja v a 2s .c o m } return null; }
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 w w w. ja v a 2s .c o m*/ } return propertySetNodes; }
From source file:Main.java
/***********************************************************************/ private static Node traverseToInnerTag(String tag, Node node) { String name = node.getNodeName(); if (name.equals(tag)) { return node; } else {/*w ww. j a va 2 s. c om*/ NodeList childNodes = node.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node child = traverseToInnerTag(tag, childNodes.item(i)); if (child != null) { return child; } } } return null; }
From source file:Main.java
public static Node getFirstChild(Node node, String childName) { NodeList nodeList = node.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node child = nodeList.item(i); if (child.getNodeName().equals(childName)) { return child; }/*from w w w . j a va 2 s .c o m*/ } return null; }
From source file:Main.java
public static String getNamespaceURI(Document doc, String ns) { NamedNodeMap attr = doc.getDocumentElement().getAttributes(); for (int i = 0; i < attr.getLength(); i++) { Node attrNode = attr.item(i); if (attrNode.getNodeName().indexOf(ns) != -1) { return (attrNode.getNodeValue()); }/* w w w . j a v a 2 s . c om*/ } return null; }
From source file:Main.java
public static Vector getDirectories(Node node) { NodeList nList = node.getChildNodes(); Vector directoryNodes = new Vector(); for (int i = 0; i < nList.getLength(); i++) { Node kidNode = nList.item(i); if (kidNode.getNodeName().equals("directory")) { directoryNodes.addElement(kidNode); }//from w w w . j a v a 2s. c o m } return directoryNodes; }
From source file:Main.java
public static Vector findChildren(Node node, String elTag) { NodeList children = node.getChildNodes(); Vector items = new Vector(); for (int i = 0; i < children.getLength(); i++) { Node item = children.item(i); if (item.getNodeName().equals(elTag)) { items.add(item);//from w w w .ja va2 s.c o m } } return items; }
From source file:Main.java
public static String getNamespaceURI(final Document doc, final String ns) { NamedNodeMap attr = doc.getDocumentElement().getAttributes(); for (int i = 0; i < attr.getLength(); i++) { Node attrNode = attr.item(i); if (attrNode.getNodeName().indexOf(ns) != -1) { return (attrNode.getNodeValue()); }/*ww w . j a va 2 s . c o m*/ } return null; }
From source file:Main.java
private static List<Node> filterOutIgnorableAttrs(NamedNodeMap map) { List<Node> list = new ArrayList<Node>(); for (int i = 0; i < map.getLength(); i++) { Node attr = map.item(i); if (!attr.getNodeName().startsWith("xmlns") && !"xsi:type".equals(attr.getNodeName())) { list.add(attr);/*from www . j av a 2 s . com*/ } } return list; }