com.im.df.api 5.9

com.im.df.api.util.xml
Class XMLUtils

java.lang.Object
  extended by com.im.df.api.util.xml.XMLUtils

public class XMLUtils
extends Object

This class should collect various XML manipulation utilities not found in JAXP APIs.


Constructor Summary
XMLUtils()
           
 
Method Summary
static Element findFirstChild(Node parent, String name)
          Finds the first direct child element named "name" under the specified parent.
static String getAttributeValue(Element parent, String attribute)
          Helper method, that returns the attribute value or null, if the attribute is not defined.
static List<Element> getChildren(Element parent, String tagName)
          Builds a list of direct child Nodes of an Element with the specified tag name.
static Object loadBean(String content, Object prototype, Lookup context)
           
static String saveBean(Object bean, Lookup context)
           
static void throwWrappedIOException(Throwable cause)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLUtils

public XMLUtils()
Method Detail

getAttributeValue

public static String getAttributeValue(Element parent,
                                       String attribute)
Helper method, that returns the attribute value or null, if the attribute is not defined. DOM method getAttribute will return an empty string, if the attribute node does not exist, which is not desirable in some cases.


findFirstChild

public static Element findFirstChild(Node parent,
                                     String name)
Finds the first direct child element named "name" under the specified parent. The method ignores XML namespaces.

Parameters:
parent - The parent to search in
name - The tag name to search for
Returns:
The Element or null, if there's no such child.

getChildren

public static List<Element> getChildren(Element parent,
                                        String tagName)
Builds a list of direct child Nodes of an Element with the specified tag name. This method does not respect XML namespaces. Note that the DOM method getElementsByTagName returns all descendants that use the specified tag, not just direct children.


throwWrappedIOException

public static void throwWrappedIOException(Throwable cause)
                                    throws IOException
Throws:
IOException

loadBean

public static Object loadBean(String content,
                              Object prototype,
                              Lookup context)
                       throws IOException
Throws:
IOException

saveBean

public static String saveBean(Object bean,
                              Lookup context)
                       throws IOException
Throws:
IOException

com.im.df.api 5.9