Here you can find the source of parseOptionNode(Node node)
public static Node parseOptionNode(Node node)
//package com.java2s; import java.util.Objects; import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static Node parseOptionNode(Node node) { Objects.requireNonNull(node); if (!(node instanceof Element) || !node.getNodeName().equalsIgnoreCase("option")) { throw new IllegalArgumentException("Node is not option: " + node);// w w w.ja v a2 s. co m } Element e = (Element) node; if (e.hasAttribute("val")) { String val = e.getAttribute("val"); if (val.equalsIgnoreCase("some")) { if (!e.hasChildNodes()) { throw new IllegalArgumentException( "Doesn't have children: " + e); } return e.getFirstChild(); } else { return null; } } else { return null; } } }