private List<String> getCCUriString(DmXMLParser xmlParser, Node node, String nodeName) { List<Node> nodeList = new ArrayList<Node>(); List<String> uriStrList = new ArrayList<String>(); xmlParser.getChildNode(node, nodeList, nodeName); for (int i = 0; i < nodeList.size(); i++) { Node tempnode = nodeList.get(i).getParentNode(); String uriStr = getDmTreeNodeName(xmlParser, tempnode); while (tempnode != null) { tempnode = tempnode.getParentNode(); String parentsName = getDmTreeNodeName(xmlParser, tempnode); if (parentsName != null && parentsName.equals(".")) { uriStr = "./" + uriStr; break; } uriStr = parentsName + "/" + uriStr; } if (uriStr != null) { if (uriStrList.size() > 0 && uriStr.contains(uriStrList.get(uriStrList.size() - 1))) { uriStrList.remove(uriStrList.size() - 1); } uriStrList.add(uriStr); } } return uriStrList; }
private String getDmTreeNodeName(DmXMLParser xmlParser, Node node) { if (node == null) { return null; } List<Node> nodeList = new ArrayList<Node>(); xmlParser.getLeafNode(node, nodeList, DmConst.TagName.Name); if (nodeList != null && nodeList.size() > 0) { return nodeList.get(0).getFirstChild().getNodeValue(); } else { return null; } }
private Node getSettingNode(DmXMLParser xmlParser) { // Here the outside loop is for the change of Setting node's // level start from 1 is to reduce recursive times // Anyway, the level should be less than 15, if reasonable for (int level = 1; level < 0x000F; level++) { List<Node> nodeList = new ArrayList<Node>(); xmlParser.getChildNodeAtLevel(nodeList, level); for (int i = 0; i < nodeList.size(); i++) { String nodeName = getDmTreeNodeName(xmlParser, nodeList.get(i)); if (nodeName != null && nodeName.equals(DmConst.TagName.Setting)) { return nodeList.get(i); } } } return null; }