Java XML Node Parent getParentElement(Node node)

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

Description

get Parent Element

License

Open Source License

Declaration

public static Element getParentElement(Node node) 

Method Source Code

//package com.java2s;

import org.w3c.dom.Node;

import org.w3c.dom.Element;

public class Main {
    public static Element getParentElement(Node node) {
        Node parent = node.getParentNode();
        if (parent == null || parent.getNodeType() != Node.ELEMENT_NODE) {
            return null;
        } else {/*w w w . ja  va  2  s.c  om*/
            return (Element) parent;
        }
    }
}

Related

  1. getParent(Node node)
  2. getParent(Node target)
  3. getParentElement(Element element)
  4. getParentElement(Element element)
  5. getParentElement(final Node node)
  6. getParentElement(Node node)
  7. getParentElement(Node node)
  8. getParentNamespaces(Element el)
  9. getParentNode(Node node)