List of utility methods to do XML Node Parse
void | parseProtoypes(Node module, Node iFace, PrintWriter out) parse Protoypes parseProtoypes(module, iFace, out, false); |
void | parsePseudoHTML(Node e, StringBuffer html) parse Pseudo HTML String nodeName = e.getNodeName(); boolean toAppendTag = !(e instanceof Text); boolean isBR = nodeName.equals("BR"); if (toAppendTag & !isBR) { html.append('<'); html.append(nodeName); html.append('>'); if (!e.hasChildNodes() && !isBR) { html.append(e.getNodeValue()); } else { NodeList nodes = e.getChildNodes(); int children = nodes.getLength(); for (int i = 0; i < children; i++) parsePseudoHTML(nodes.item(i), html); if (toAppendTag) { if (isBR) { html.append("<BR>"); } else { html.append("</"); html.append(nodeName); html.append(">\n"); |
String | parseSpelling(Node spelling) parse Spelling StringBuilder sb = new StringBuilder(); NodeList sc = spelling.getChildNodes(); int len = sc.getLength(); for (int i = 0; i < len; i++) { Node nn = sc.item(i); if (nn.getNodeName().equalsIgnoreCase("degree")) { sb.append(nn.getTextContent()); sb.append(' '); ... |
String[] | parseStringIdList(Node e) parse String Id List if (e == null || e.getNodeType() != Node.ELEMENT_NODE || !e.getNodeName().equals("id-list")) throw new IllegalArgumentException(); Node cur = e.getFirstChild(); int count = 0; while (cur != null) { if (cur.getNodeType() != Node.ELEMENT_NODE) throw new Exception("<id-list> contains an unknown child"); if (!cur.getNodeName().equals("id")) ... |
List | parseStringList(Node node) parse String List List<Node> nodes = parseList(node); List<String> strings = new ArrayList<>(nodes.size()); for (Node child : nodes) { strings.add(parseString(child)); return strings; |