@Test public void getMatchingChildNodes_withNullAttributeValues_shouldReturnMultiple() throws Exception { List<Node> results = XmlUtils.getMatchingChildNodes(purchaseOrderNode, "aw:PurchaseOrder", "aw:OrderDate", null); assertThat(results.size()).isEqualTo(3); }
static List<Node> getMatchingChildNodes(final Node node, final String nodeName, final String attributeName, final List<String> attributeValues) { if (node == null || nodeName == null) { return null; } final List<Node> nodes = new ArrayList<Node>(); final NodeList nodeList = node.getChildNodes(); for (int i = 0; i < nodeList.getLength(); ++i) { Node childNode = nodeList.item(i); if (childNode.getNodeName().equals(nodeName) && nodeMatchesAttributeFilter(childNode, attributeName, attributeValues)) { nodes.add(childNode); } } return nodes; }
XmlUtils { static List<Node> getMatchingChildNodes(final Node node, final String nodeName, final String attributeName, final List<String> attributeValues) { if (node == null || nodeName == null) { return null; } final List<Node> nodes = new ArrayList<Node>(); final NodeList nodeList = node.getChildNodes(); for (int i = 0; i < nodeList.getLength(); ++i) { Node childNode = nodeList.item(i); if (childNode.getNodeName().equals(nodeName) && nodeMatchesAttributeFilter(childNode, attributeName, attributeValues)) { nodes.add(childNode); } } return nodes; } }
XmlUtils { static List<Node> getMatchingChildNodes(final Node node, final String nodeName, final String attributeName, final List<String> attributeValues) { if (node == null || nodeName == null) { return null; } final List<Node> nodes = new ArrayList<Node>(); final NodeList nodeList = node.getChildNodes(); for (int i = 0; i < nodeList.getLength(); ++i) { Node childNode = nodeList.item(i); if (childNode.getNodeName().equals(nodeName) && nodeMatchesAttributeFilter(childNode, attributeName, attributeValues)) { nodes.add(childNode); } } return nodes; } private  XmlUtils(); }
XmlUtils { static List<Node> getMatchingChildNodes(final Node node, final String nodeName, final String attributeName, final List<String> attributeValues) { if (node == null || nodeName == null) { return null; } final List<Node> nodes = new ArrayList<Node>(); final NodeList nodeList = node.getChildNodes(); for (int i = 0; i < nodeList.getLength(); ++i) { Node childNode = nodeList.item(i); if (childNode.getNodeName().equals(nodeName) && nodeMatchesAttributeFilter(childNode, attributeName, attributeValues)) { nodes.add(childNode); } } return nodes; } private  XmlUtils();  }
XmlUtils { static List<Node> getMatchingChildNodes(final Node node, final String nodeName, final String attributeName, final List<String> attributeValues) { if (node == null || nodeName == null) { return null; } final List<Node> nodes = new ArrayList<Node>(); final NodeList nodeList = node.getChildNodes(); for (int i = 0; i < nodeList.getLength(); ++i) { Node childNode = nodeList.item(i); if (childNode.getNodeName().equals(nodeName) && nodeMatchesAttributeFilter(childNode, attributeName, attributeValues)) { nodes.add(childNode); } } return nodes; } private  XmlUtils();   }