fr.opensagres.xdocreport.core.utils
Class DOMUtils

java.lang.Object
  extended by fr.opensagres.xdocreport.core.utils.DOMUtils

public class DOMUtils
extends Object


Constructor Summary
DOMUtils()
           
 
Method Summary
static Element getFirstChildElementByTagName(Node parentNode, String elementName)
          Returns the first child element retrieved by tag name from the parent node and null otherwise.
static Collection<Element> getFirstChildElementsByTagName(Node contextNode, String elementName)
          Returns list of the first child element retrieved by tag name from the parent node and null otherwise.
static Document load(InputStream stream)
           
static Document load(String xml)
           
static void save(Node node, OutputStream out)
           
static void save(Node node, Writer writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMUtils

public DOMUtils()
Method Detail

load

public static Document load(InputStream stream)
                     throws ParserConfigurationException,
                            SAXException,
                            IOException
Throws:
ParserConfigurationException
SAXException
IOException

load

public static Document load(String xml)
                     throws ParserConfigurationException,
                            SAXException,
                            IOException
Throws:
ParserConfigurationException
SAXException
IOException

save

public static void save(Node node,
                        Writer writer)
                 throws TransformerException
Throws:
TransformerException

save

public static void save(Node node,
                        OutputStream out)
                 throws TransformerException
Throws:
TransformerException

getFirstChildElementByTagName

public static Element getFirstChildElementByTagName(Node parentNode,
                                                    String elementName)
Returns the first child element retrieved by tag name from the parent node and null otherwise.

Parameters:
parentNode - parent node.
elementName - element name to found.
Returns:
the first child element

getFirstChildElementsByTagName

public static Collection<Element> getFirstChildElementsByTagName(Node contextNode,
                                                                 String elementName)
Returns list of the first child element retrieved by tag name from the parent node and null otherwise.

Parameters:
parentNode - parent node.
elementName - element name to found.
Returns:
list of the first child element


Copyright © 2013. All rights reserved.