net.sf.jec.util
Class XMLHelper

java.lang.Object
  extended bynet.sf.jec.util.XMLHelper

public class XMLHelper
extends java.lang.Object

Helper class for commond XML handling tasks

Author:
mballesteros

Constructor Summary
XMLHelper()
           
 
Method Summary
static org.w3c.dom.Element createBrother(org.w3c.dom.Element el)
          Creates an empty brother (same parent, same tag name)
static org.w3c.dom.Element createBrother(org.w3c.dom.Element el, java.lang.String text)
          Creates an empty brother (same parent, same tag name) with a text node
static java.lang.Object getChild(org.w3c.dom.Element el, java.lang.String childName)
          Returns children of a given Element.
static java.lang.String getText(org.w3c.dom.Element el)
          Returns the concatenation of every element's child text node
static void setChild(org.w3c.dom.Element el, java.lang.String childName, java.lang.Object value)
          Creates a new child element with the given name, removing any existing element for that name.
static void setText(org.w3c.dom.Element el, java.lang.String value)
          Sets element's text, erasing previous value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLHelper

public XMLHelper()
Method Detail

getText

public static java.lang.String getText(org.w3c.dom.Element el)
Returns the concatenation of every element's child text node


setText

public static void setText(org.w3c.dom.Element el,
                           java.lang.String value)
Sets element's text, erasing previous value


getChild

public static java.lang.Object getChild(org.w3c.dom.Element el,
                                        java.lang.String childName)
Returns children of a given Element. If there are several children, a NodeList is returned. If there is only one child, it is returned. If there is no child for that name, a new one is created and returned.


setChild

public static void setChild(org.w3c.dom.Element el,
                            java.lang.String childName,
                            java.lang.Object value)
Creates a new child element with the given name, removing any existing element for that name. If value is a Node, it will be added as a child to the new element. If value is a String, a new text node will be created and added to the new element.


createBrother

public static org.w3c.dom.Element createBrother(org.w3c.dom.Element el)
Creates an empty brother (same parent, same tag name)


createBrother

public static org.w3c.dom.Element createBrother(org.w3c.dom.Element el,
                                                java.lang.String text)
Creates an empty brother (same parent, same tag name) with a text node



Copyright © 2003 SourceForge. All Rights Reserved.