Code example for Node

Methods: getClass, getParentNode

0
      return "<" + node.getNodeName() + "> element";
    } else if (node instanceof Attr) {
      return node.getNodeName() + " attribute of the " +
          describeNode(((Attr) node).getOwnerElement());
    } else if (node instanceof Text) {
      return describeNode(node.getParentNode());
    } 
    throw new IllegalArgumentException("node must an Element, an Attr, or a Text: " +
        node.getClass().getName());
  } 
}