Java XML Element Root getRoot(final Document doc)

Here you can find the source of getRoot(final Document doc)

Description

Get root element of the given document.

License

Open Source License

Declaration

public static Element getRoot(final Document doc) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 *     Copyright (c) 2006-2010 eBay Inc. All Rights Reserved.
 *     Licensed under the Apache License, Version 2.0 (the "License"); 
 *     you may not use this file except in compliance with the License. 
 *     You may obtain a copy of the License at 
 *    /*  www . ja  v a  2  s .  c  o  m*/
 *        http://www.apache.org/licenses/LICENSE-2.0
 *******************************************************************************/

import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class Main {
    /**
      * Get root element of the given document.
      */
    public static Element getRoot(final Document doc) {
        if (doc != null)
            return doc.getDocumentElement();
        return null;
    }
}

Related

  1. getElementValue(Element root, String name)
  2. getElementValueLong(Element root, String name)
  3. getRoot(Document doc)
  4. getRoot(Document doc)
  5. getRoot(Document document)
  6. getRoot(SOAPElement e)
  7. getRootElement(Document d)
  8. getRootElement(Document doc)
  9. getRootElement(Document doc)