Java Code Examples for org.w3c.dom.Node.getClass()

The following are Jave code examples for showing how to use getClass() of the org.w3c.dom.Node class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: incubator-netbeans   File: DomVisitor.java   Source Code and License Vote up 5 votes
public void visit(Node node) {
   final Class clazz = node.getClass();
   if (Element.class.isAssignableFrom(clazz)) {
      visit((Element) node);
   } else if (Document.class.isAssignableFrom(clazz)) {
      visit((Document) node);
   } else if (Text.class.isAssignableFrom(clazz)) {
      visit((Text) node);
   } else {
      throw new RuntimeException("Unhandled node class type " + clazz.getName());
   }
}