Code example for Node

Methods: getNodeType

0
 
 
    public boolean test(Node node) {
        // we only want to process nodes which have an attribute with name "number" 
 
        return node.getNodeType() == Node.ELEMENT_NODE && ((Element) node).hasAttribute("number");
    } 
 
    public void process(Node node) {
        // do something with the Node 
 
        String indentation = "";
        String elementName = ((Element) node).getTagName();
        if (elementName.equals("article")) {
            indentation = "  ";
        } 
 
        System.out.println(indentation + elementName + " " + ((Element) node).getAttribute("number"));
    } 
 
    public boolean isDone(Node node) {