private static IPeakSet<? extends IPeak> parsePeakSet(Node parent) throws XmlParserException { // retrieve all the properties Vector<IPeak> peaks = new Vector<IPeak>(); NodeList nodes = parent.getChildNodes(); for (int nodeid = 0; nodeid < nodes.getLength(); ++nodeid) { Node node = nodes.item(nodeid); if (node.getNodeType() != Node.ELEMENT_NODE) continue; Element element = (Element) node; if (element.getTagName().equals("peaks")) { NodeList nodes2 = node.getChildNodes(); for (int nodeid2 = 0; nodeid2 < nodes2.getLength(); ++nodeid2) { Node node2 = nodes2.item(nodeid2); if (node2.getNodeType() != Node.ELEMENT_NODE) continue; IPeak peak = parseIPeak(node2); if (peak != null) peaks.add(peak); } } } // create the bugger IPeakSet<IPeak> peakset = new IPeakSet<IPeak>(peaks); parseIPeak(parent, peakset); return peakset; }
static { try { URL url = SpellCheckActivator.bundleContext.getBundle().getResource(RESOURCE_LOC); InputStream stream = url.openStream(); if (stream == null) throw new IOException(); // strict parsing options DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); factory.setIgnoringComments(true); factory.setIgnoringElementContentWhitespace(true); // parses configuration xml /*- * Warning: Felix is unable to import the com.sun.rowset.internal * package, meaning this can't use the XmlErrorHandler. This causes * a warning and a default handler to be attached. Otherwise this * should have: builder.setErrorHandler(new XmlErrorHandler()); */ DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(stream); // iterates over nodes, parsing contents Node root = doc.getChildNodes().item(1); NodeList categories = root.getChildNodes(); for (int i = 0; i < categories.getLength(); ++i) { Node node = categories.item(i); if (node.getNodeName().equals(NODE_DEFAULTS)) { parseDefaults(node.getChildNodes()); } else if (node.getNodeName().equals(NODE_LOCALES)) { parseLocales(node.getChildNodes()); } else { logger.warn("Unrecognized category: " + node.getNodeName()); } } } catch (IOException exc) { logger.error("Unable to load spell checker parameters", exc); } catch (SAXException exc) { logger.error("Unable to parse spell checker parameters", exc); } catch (ParserConfigurationException exc) { logger.error("Unable to parse spell checker parameters", exc); } }
public static final Map parseFrame(Node node) { NodeList bones = node.getChildNodes(); Map bone_infos = new HashMap(); for (int i = 0; i < bones.getLength(); i++) { Node bone = bones.item(i); if (bone.getNodeName().equals("transform")) { String name = bone.getAttributes().getNamedItem("name").getNodeValue(); float[] matrix = new float[16]; matrix[0 * 4 + 0] = getAttrFloat(bone, "m00"); matrix[0 * 4 + 1] = getAttrFloat(bone, "m01"); matrix[0 * 4 + 2] = getAttrFloat(bone, "m02"); matrix[0 * 4 + 3] = getAttrFloat(bone, "m03"); matrix[1 * 4 + 0] = getAttrFloat(bone, "m10"); matrix[1 * 4 + 1] = getAttrFloat(bone, "m11"); matrix[1 * 4 + 2] = getAttrFloat(bone, "m12"); matrix[1 * 4 + 3] = getAttrFloat(bone, "m13"); matrix[2 * 4 + 0] = getAttrFloat(bone, "m20"); matrix[2 * 4 + 1] = getAttrFloat(bone, "m21"); matrix[2 * 4 + 2] = getAttrFloat(bone, "m22"); matrix[2 * 4 + 3] = getAttrFloat(bone, "m23"); matrix[3 * 4 + 0] = getAttrFloat(bone, "m30"); matrix[3 * 4 + 1] = getAttrFloat(bone, "m31"); matrix[3 * 4 + 2] = getAttrFloat(bone, "m32"); matrix[3 * 4 + 3] = getAttrFloat(bone, "m33"); bone_infos.put(name, matrix); } } return bone_infos; }
/** * Converts an XML element into an <code>EppCommandRenewXriName</code> object. The caller of this * method must make sure that the root node is of an EPP Command Renew entity for EPP XRI I-Name * object * * @param root root node for an <code>EppCommandRenewXriName</code> object in XML format * @return an <code>EppCommandRenewXriName</code> object, or null if the node is invalid */ public static EppEntity fromXML(Node root) { EppCommandRenewXriName cmd = null; String iname = null; Calendar curExpDate = null; EppPeriod period = null; NodeList list = root.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); String name = node.getLocalName(); if (name == null) { continue; } if (name.equals("iname")) { iname = EppUtil.getText(node); } else if (name.equals("curExpDate")) { curExpDate = EppUtil.getDate(node, true); } else if (name.equals("period")) { period = (EppPeriod) EppPeriod.fromXML(node); } } if (iname != null) { cmd = new EppCommandRenewXriName(iname, curExpDate, period, null); } return cmd; }
private static Command parseCommand(Node n) { NamedNodeMap atts = n.getAttributes(); String name = atts.getNamedItem("name").getNodeValue(); String desc = atts.getNamedItem("description").getNodeValue(); String command = atts.getNamedItem("command").getNodeValue(); Command com = new Command(name, desc, command); NodeList children = n.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (!child.getNodeName().equals("Argument")) continue; NamedNodeMap childAtts = child.getAttributes(); String childName = childAtts.getNamedItem("name").getNodeValue(); String childDesc = childAtts.getNamedItem("description").getNodeValue(); String childVal = ""; if (childAtts.getNamedItem("default") != null) childVal = childAtts.getNamedItem("default").getNodeValue(); Argument arg = new Argument(childName, childDesc, childVal); com.addArgument(arg); } return com; }
private void initAllowedHosts(Document pDoc) { NodeList nodes = pDoc.getElementsByTagName("remote"); if (nodes.getLength() == 0) { // No restrictions found allowedHostsSet = null; return; } allowedHostsSet = new HashSet<String>(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); NodeList childs = node.getChildNodes(); for (int j = 0; j < childs.getLength(); j++) { Node hostNode = childs.item(j); if (hostNode.getNodeType() != Node.ELEMENT_NODE) { continue; } assertNodeName(hostNode, "host"); String host = hostNode.getTextContent().trim().toLowerCase(); if (SUBNET_PATTERN.matcher(host).matches()) { if (allowedSubnetsSet == null) { allowedSubnetsSet = new HashSet<String>(); } allowedSubnetsSet.add(host); } else { allowedHostsSet.add(host); } } } }
private static MeasurementInfo parseMeasurement(Node parent) throws XmlParserException { String id = ""; String label = ""; String sampleid = ""; Vector<FileInfo> files = null; Vector<ScanInfo> scans = null; NodeList nodes = parent.getChildNodes(); for (int nodeid = 0; nodeid < nodes.getLength(); ++nodeid) { Node node = nodes.item(nodeid); if (node.getNodeType() != Node.ELEMENT_NODE) continue; Element element = (Element) node; if (element.getTagName().equals("id")) id = element.getTextContent(); else if (element.getTagName().equals("label")) label = element.getTextContent(); else if (element.getTagName().equals("sampleid")) sampleid = element.getTextContent(); else if (element.getTagName().equals("scans")) scans = parseScans(node); else if (element.getTagName().equals("files")) files = parseFiles(node); } MeasurementInfo measurement = new MeasurementInfo(Integer.parseInt(id), sampleid); measurement.setLabel(label); measurement.addFileInfos(files); if (scans != null) measurement.addScanInfos(scans); return measurement; }
private void extractMBeanPolicy(MBeanPolicyConfig pConfig, Node pMBeanNode) throws MalformedObjectNameException { NodeList params = pMBeanNode.getChildNodes(); String name = null; Set<String> readAttributes = new HashSet<String>(); Set<String> writeAttributes = new HashSet<String>(); Set<String> operations = new HashSet<String>(); for (int k = 0; k < params.getLength(); k++) { Node param = params.item(k); if (param.getNodeType() != Node.ELEMENT_NODE) { continue; } assertNodeName(param, "name", "attribute", "operation"); String tag = param.getNodeName(); if (tag.equals("name")) { if (name != null) { throw new SecurityException("<name> given twice as MBean name"); } else { name = param.getTextContent().trim(); } } else if (tag.equals("attribute")) { extractAttribute(readAttributes, writeAttributes, param); } else if (tag.equals("operation")) { operations.add(param.getTextContent().trim()); } else { throw new SecurityException("Tag <" + tag + "> invalid"); } } if (name == null) { throw new SecurityException("No <name> given for <mbean>"); } pConfig.addValues(new ObjectName(name), readAttributes, writeAttributes, operations); }
private Node[] processIndexNode( final Node theNode, final Document theTargetDocument, final IndexEntryFoundListener theIndexEntryFoundListener) { theNode.normalize(); boolean ditastyle = false; String textNode = null; final NodeList childNodes = theNode.getChildNodes(); final StringBuilder textBuf = new StringBuilder(); final List<Node> contents = new ArrayList<Node>(); for (int i = 0; i < childNodes.getLength(); i++) { final Node child = childNodes.item(i); if (checkElementName(child)) { ditastyle = true; break; } else if (child.getNodeType() == Node.ELEMENT_NODE) { textBuf.append(XMLUtils.getStringValue((Element) child)); contents.add(child); } else if (child.getNodeType() == Node.TEXT_NODE) { textBuf.append(child.getNodeValue()); contents.add(child); } } textNode = IndexStringProcessor.normalizeTextValue(textBuf.toString()); if (textNode.length() == 0) { textNode = null; } if (theNode.getAttributes().getNamedItem(elIndexRangeStartName) != null || theNode.getAttributes().getNamedItem(elIndexRangeEndName) != null) { ditastyle = true; } final ArrayList<Node> res = new ArrayList<Node>(); if ((ditastyle)) { final IndexEntry[] indexEntries = indexDitaProcessor.processIndexDitaNode(theNode, ""); for (final IndexEntry indexEntrie : indexEntries) { theIndexEntryFoundListener.foundEntry(indexEntrie); } final Node[] nodes = transformToNodes(indexEntries, theTargetDocument, null); for (final Node node : nodes) { res.add(node); } } else if (textNode != null) { final Node[] nodes = processIndexString(textNode, contents, theTargetDocument, theIndexEntryFoundListener); for (final Node node : nodes) { res.add(node); } } else { return new Node[0]; } return (Node[]) res.toArray(new Node[res.size()]); }
private static SetInfo parseSet(Node parent) throws XmlParserException { String id = ""; String type = ""; String measurementids = null; NodeList nodes = parent.getChildNodes(); Vector<SetInfo> sets = new Vector<SetInfo>(); for (int nodeid = 0; nodeid < nodes.getLength(); ++nodeid) { Node node = nodes.item(nodeid); if (node.getNodeType() != Node.ELEMENT_NODE) continue; Element element = (Element) node; if (element.getTagName().equals("id")) id = element.getTextContent(); else if (element.getTagName().equals("set")) sets.add(parseSet(element)); else if (element.getTagName().equals("type")) type = element.getTextContent(); else if (element.getTagName().equals("measurementids")) measurementids = element.getTextContent(); } // create the set SetInfo set = new SetInfo(id, Integer.parseInt(type)); if (measurementids != null) { int mids[] = ByteArray.toIntArray(Base64.decode(measurementids), ByteArray.ENDIAN_LITTLE, 32); for (int mid : mids) set.addMeasurementID(mid); } // add the children for (SetInfo s : sets) set.addChild(s); return set; }
private static Header parseHeader(Node parent) throws XmlParserException { Header header = new Header(); NodeList nodes = parent.getChildNodes(); for (int nodeid = 0; nodeid < nodes.getLength(); ++nodeid) { Node node = nodes.item(nodeid); if (node.getNodeType() != Node.ELEMENT_NODE) continue; Element element = (Element) node; try { if (element.getTagName().equals("nrpeaks")) header.setNrPeaks(Integer.parseInt(element.getTextContent())); else if (element.getTagName().equals("date")) header.setDate(element.getTextContent()); else if (element.getTagName().equals("owner")) header.setOwner(element.getTextContent()); else if (element.getTagName().equals("description")) header.setDescription(element.getTextContent()); else if (element.getTagName().equals("sets")) header.addSetInfos(parseSets(element)); else if (element.getTagName().equals("measurements")) header.addMeasurementInfos(parseMeasurements(element)); else if (element.getTagName().equals("annotations")) { Vector<Annotation> annotations = parseAnnotations(element); if (annotations != null) for (Annotation annotation : annotations) header.addAnnotation(annotation); } } catch (Exception e) { throw new XmlParserException( "Invalid value in header (" + element.getTagName() + "): '" + e.getMessage() + "'."); } } return header; }
public static void removeNodesByName(Node node, String name) { NodeList nl = node.getChildNodes(); int i = 0; while (i < nl.getLength()) if (nl.item(i).getNodeName().equals(name)) node.removeChild(nl.item(i)); else i++; }
public static void removeTextNodes(Node node) { NodeList nl = node.getChildNodes(); int i = 0; while (i < nl.getLength()) if (nl.item(i).getNodeType() == Node.TEXT_NODE) node.removeChild(nl.item(i)); else i++; }
protected void cacheDescendantsHelper(Node n) { for (Node child : n.getChildNodes()) { if (descendants.contains(child)) { continue; } descendants.add(child); cacheDescendantsHelper(child); } }
public static Collection<Node> getChildNodes(Node node) { Collection<Node> list = new LinkedList<Node>(); NodeList nl = node.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) if (nl.item(i).getNodeType() == Node.ELEMENT_NODE) list.add(nl.item(i)); return list; }
public static Collection<Node> getNodesByName(Node node, String name) { Collection<Node> list = new LinkedList<Node>(); NodeList nl = node.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) if (nl.item(i).getNodeName().equals(name)) list.add(nl.item(i)); return list; }
public static String text(Node node) { if (node.getNodeType() == Node.TEXT_NODE) { return node.getNodeValue(); } if (node.hasChildNodes()) { return text(node.getChildNodes()); } return ""; }
// Extract configuration and put it into a given MBeanPolicyConfig private void extractMbeanConfiguration(NodeList pNodes, MBeanPolicyConfig pConfig) throws MalformedObjectNameException { for (int i = 0; i < pNodes.getLength(); i++) { Node node = pNodes.item(i); if (node.getNodeType() != Node.ELEMENT_NODE) { continue; } extractPolicyConfig(pConfig, node.getChildNodes()); } }
private static void parseIPeak(Node parent, IPeak peak) throws XmlParserException { // retrieve all the properties int scan = -1; double retentiontime = -1; double mass = -1; double intensity = -1; int patternid = -1; int measurementid = -1; // String sha1 = null; Vector<Annotation> annotations = null; NodeList nodes = parent.getChildNodes(); for (int nodeid = 0; nodeid < nodes.getLength(); ++nodeid) { Node node = nodes.item(nodeid); if (node.getNodeType() != Node.ELEMENT_NODE) continue; Element element = (Element) node; if (element.getTagName().equals("patternid")) patternid = Integer.parseInt(element.getTextContent()); else if (element.getTagName().equals("measurementid")) measurementid = Integer.parseInt(element.getTextContent()); else if (element.getTagName().equals("annotations")) annotations = parseAnnotations(element); else if (element.getTagName().equals("scan")) scan = Integer.parseInt(element.getTextContent()); else if (element.getTagName().equals("retentiontime")) retentiontime = Double.parseDouble(element.getTextContent()); else if (element.getTagName().equals("mass")) mass = Double.parseDouble(element.getTextContent()); else if (element.getTagName().equals("intensity")) intensity = Double.parseDouble(element.getTextContent()); // else if (element.getTagName().equals("sha1sum")) // sha1 = element.getTextContent(); } // check whether obligatory values are missing if (mass == -1 || intensity == -1) throw new XmlParserException("Mass and/or intensity information is missing for IPeak."); peak.setScanID(scan); peak.setRetentionTime(retentiontime); peak.setMass(mass); peak.setIntensity(intensity); peak.setPatternID(patternid); peak.setMeasurementID(measurementid); if (annotations != null) for (Annotation annotation : annotations) peak.addAnnotation(annotation); // check whether // if (sha1!=null && !sha1.equals(peak.sha1())) // throw new XmlParserException("SHA1-sum for individual ipeak element does not match."); }
private static String getTextContent(Node n) { NodeList nodeList = n.getChildNodes(); String textContent = ""; for (int j = 0; j < nodeList.getLength(); j++) { Node k = nodeList.item(j); if (k.getNodeType() == Node.TEXT_NODE) { textContent = k.getNodeValue(); break; } } return textContent; }
public static void traverseAMLforObjectNames( HashMap partialMap, Node currentNode, HashMap ObjDef_LinkId, HashMap ModelId_ModelType) { if (currentNode.hasChildNodes()) { for (int i = 0; i < currentNode.getChildNodes().getLength(); i++) { Node currentChild = currentNode.getChildNodes().item(i); if (currentChild.getNodeName().equals("Group")) { traverseAMLforObjectNames(partialMap, currentChild, ObjDef_LinkId, ModelId_ModelType); } if (currentChild.getNodeName().equals("Model")) { if (currentChild.hasAttributes()) { String mid = currentChild.getAttributes().getNamedItem("Model.ID").getNodeValue(); String type = currentChild.getAttributes().getNamedItem("Model.Type").getNodeValue(); ModelId_ModelType.put(mid, type); } // traverseAMLforObjectNames(partialMap, currentChild, // ObjDef_LinkId); } if (currentChild.getNodeName().equals("ObjDef")) { String id = currentChild.getAttributes().getNamedItem("ObjDef.ID").getNodeValue(); NodeList currentChildren = currentChild.getChildNodes(); String ObjName = ""; for (int k = 0; k < currentChildren.getLength(); k++) { Node Child = currentChildren.item(k); if (!Child.getNodeName().equals("AttrDef")) { continue; } else if (!Child.getAttributes() .getNamedItem("AttrDef.Type") .getNodeValue() .equals("AT_NAME")) { continue; } else if (Child.hasChildNodes()) { for (int l = 0; l < Child.getChildNodes().getLength(); l++) { if (!(Child.getChildNodes().item(l).getNodeName().equals("AttrValue"))) { continue; } else { ObjName = getTextContent(Child.getChildNodes().item(l)); ObjName = ObjName.replaceAll("\n", "\\\\n"); break; } } } } partialMap.put(id, ObjName); for (int j = 0; j < currentChild.getAttributes().getLength(); j++) { if (currentChild.getAttributes().item(j).getNodeName().equals("LinkedModels.IdRefs")) { String links = currentChild.getAttributes().getNamedItem("LinkedModels.IdRefs").getNodeValue(); /* * if (links.indexOf(" ") > -1) { * Message.add("yes, yes, yes"); links = * links.substring(0, links.indexOf(" ")); } */ ObjDef_LinkId.put(id, links); } } } } } }
private static Vector<FileInfo> parseFiles(Node parent) throws XmlParserException { Vector<FileInfo> files = new Vector<FileInfo>(); NodeList nodes = parent.getChildNodes(); for (int nodeid = 0; nodeid < nodes.getLength(); ++nodeid) { Node node = nodes.item(nodeid); if (node.getNodeType() != Node.ELEMENT_NODE) continue; Element element = (Element) node; if (element.getTagName().equals("file")) files.add(parseFile(node)); } return files; }
public static Node getNodeByName(Node node, String name) { if (node == null) return null; NodeList nl = node.getChildNodes(); Node n = null; int i = 0; while (n == null && i < nl.getLength()) { if (nl.item(i).getNodeName().equals(name)) n = nl.item(i); i++; } return n; }
private static Category parseCategory(Node n) { NamedNodeMap atts = n.getAttributes(); String name = atts.getNamedItem("name").getNodeValue(); String desc = atts.getNamedItem("description").getNodeValue(); Category cat = new Category(name, desc); NodeList children = n.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { parseNode(children.item(i), cat); } return cat; }
protected boolean isAncestorHelper(List<Node> children, Node node, Set<Node> seenNodes) { for (Node n : children) { if (seenNodes.contains(n)) { continue; } seenNodes.add(n); if (n.equals(node)) { return true; } if (isAncestorHelper(n.getChildNodes(), node, seenNodes)) { return true; } } return false; }
private String sustraerInformacionNodo(CliGol cliGol, Node nodo) { String[] excluye = { "CLI_ID", "CLI_SAP", "CliApePat", "CliApeMat", "CliNom", "CLI_FEC_NAC", "CLI_DOM_CAL", "CLI_DOM_NUM_EXT", "CLI_DOM_NUM_INT", "CLI_DOM_COL", "CLI_POS_ID", "CliGolP1", "CliGolP8", "CliGolP10", "CliGolP11", "CliGolP15", "CliGolP17", "CliGolP18", "CliGolP25", "CliGolResAct", "CliGolNumTar", "CliGolCtaChe", "CliGolCrePer", "CliGolCreAut", "CliGolCreHip", "CliGolOtrCre", "CliBurMens", "PagRnt", "CliGolBurCre", "CliBurValr", "CliGolIng", "CliGolImpRen" }; NodeList variables = nodo.getChildNodes(); LinkedHashMap[] mapas = obtenerMapeos(cliGol, variables, excluye); Dao dao = new Dao(); Object[] descripciones = dao.ObtenLista(mapas[0], Arrays.asList(excluye)); // <variable,puntos>,descripciones return unirMapeos(mapas[1], descripciones); }
/* return the value of the XML text node (never null) */ protected static String GetNodeText(Node root) { StringBuffer sb = new StringBuffer(); if (root != null) { NodeList list = root.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node n = list.item(i); if (n.getNodeType() == Node.CDATA_SECTION_NODE) { // CDATA Section sb.append(n.getNodeValue()); } else if (n.getNodeType() == Node.TEXT_NODE) { sb.append(n.getNodeValue()); } else { // Print.logWarn("Unrecognized node type: " + n.getNodeType()); } } } return sb.toString(); }
/** * Converts an XML element into an <code>EppResponseDataRenewXriNumber</code> object. The caller * of this method must make sure that the root node is the resData element of EPP responseType for * creating an EPP XRI I-Number object * * @param root root node for an <code>EppResponseDataRenewXriNumber</code> object in XML format * @return an <code>EppResponseDataRenewXriNumber</code> object, or null if the node is invalid */ public static EppEntity fromXML(Node root) { String i_number = null; Calendar exDate = null; NodeList list = root.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); String name = node.getLocalName(); if (name == null) { continue; } else if (name.equals("inumber")) { i_number = EppUtil.getText(node); } else if (name.equals("exDate")) { exDate = EppUtil.getDate(node); } } return new EppResponseDataRenewXriNumber(i_number, exDate); }
/** * Processes curr node. Copies node to the target document if its is not a text node of index * entry element. Otherwise it process it and creates nodes with "prefix" in given "namespace_url" * from the parsed index entry text. * * @param theNode node to process * @param theTargetDocument target document used to import and create nodes * @param theIndexEntryFoundListener listener to notify that new index entry was found * @return the array of nodes after processing input node */ private Node[] processCurrNode( final Node theNode, final Document theTargetDocument, final IndexEntryFoundListener theIndexEntryFoundListener) { final NodeList childNodes = theNode.getChildNodes(); if (checkElementName(theNode)) { return processIndexNode(theNode, theTargetDocument, theIndexEntryFoundListener); } else { final Node result = theTargetDocument.importNode(theNode, false); for (int i = 0; i < childNodes.getLength(); i++) { final Node[] processedNodes = processCurrNode(childNodes.item(i), theTargetDocument, theIndexEntryFoundListener); for (final Node node : processedNodes) { result.appendChild(node); } } return new Node[] {result}; } }
// =============================================================================== // Parsing routines private void initTypeSet(Document pDoc) { NodeList nodes = pDoc.getElementsByTagName("commands"); if (nodes.getLength() > 0) { // Leave typeSet null if no commands has been given... typeSet = new HashSet<JmxRequest.Type>(); } for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); NodeList childs = node.getChildNodes(); for (int j = 0; j < childs.getLength(); j++) { Node commandNode = childs.item(j); if (commandNode.getNodeType() != Node.ELEMENT_NODE) { continue; } assertNodeName(commandNode, "command"); String typeName = commandNode.getTextContent().trim(); JmxRequest.Type type = JmxRequest.Type.valueOf(typeName.toUpperCase()); typeSet.add(type); } } }