Java XML Node Parent getParentElement(Node node)

Here you can find the source of getParentElement(Node node)

Description

Gets parent element or null if there is none.

License

Apache License

Declaration

public static Element getParentElement(Node node) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.Element;

import org.w3c.dom.Node;

public class Main {
    /** Gets parent element or null if there is none. */
    public static Element getParentElement(Node node) {
        Node parent = node.getParentNode();
        return (parent instanceof Element ? (Element) parent : null);
    }//from www  .ja  v  a  2s.  c o  m
}

Related

  1. getParentElement(Element element)
  2. getParentElement(Element element)
  3. getParentElement(final Node node)
  4. getParentElement(Node node)
  5. getParentElement(Node node)
  6. getParentNamespaces(Element el)
  7. getParentNode(Node node)
  8. getParentNodeNoEx(Node node, String name)
  9. getParentOfNode(Node node)