Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.ejb.packaging
Class XmlHelper

    java.lang.Object
      org.hibernate.ejb.packaging.XmlHelper

    public final class XmlHelper

extends java.lang.Object

A utility class to cover up the rough bits of xml parsing

Version:
  $Revision: 11282 $
Author:
  Chris Kimpton

Method Summary
`static java.util.Iterator` | `getChildrenByTagName(org.w3c.dom.Element element, java.lang.String tagName)` Returns an iterator over the children of the given element with the given tag name.
`static java.lang.String` | `getElementContent(org.w3c.dom.Element element)` Get the content of the given element.
`static java.lang.String` | `getElementContent(org.w3c.dom.Element element, java.lang.String defaultStr)` Get the content of the given element.
`static org.w3c.dom.Element` | `getOptionalChild(org.w3c.dom.Element element, java.lang.String tagName)` Gets the child of the specified element having the specified name.
`static org.w3c.dom.Element` | `getOptionalChild(org.w3c.dom.Element element, java.lang.String tagName, org.w3c.dom.Element defaultElement)` Gets the child of the specified element having the specified name.
`static boolean` | `getOptionalChildBooleanContent(org.w3c.dom.Element element, java.lang.String name)`
`static java.lang.String` | `getOptionalChildContent(org.w3c.dom.Element element, java.lang.String tagName)` Macro to get the content of an optional child element.
`static org.w3c.dom.Element` | `getUniqueChild(org.w3c.dom.Element element, java.lang.String tagName)` Gets the child of the specified element having the specified unique name.
`static java.lang.String` | `getUniqueChildContent(org.w3c.dom.Element element, java.lang.String tagName)` Macro to get the content of a unique child element.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getChildrenByTagName

    public static java.util.Iterator getChildrenByTagName(org.w3c.dom.Element element,
                                                          java.lang.String tagName)

  Returns an iterator over the children of the given element with the given tag name.

  Parameters:
    `element` - The parent element
    `tagName` - The name of the desired child
  Returns:
    An interator of children or null if element is null.

### getUniqueChild

    public static org.w3c.dom.Element getUniqueChild(org.w3c.dom.Element element,
                                                     java.lang.String tagName)
                                              throws java.lang.Exception

  Gets the child of the specified element having the specified unique name. If there are more than one children elements with the same name and exception is thrown.

  Parameters:
    `element` - The parent element
    `tagName` - The name of the desired child
  Returns:
    The named child.
  Throws:
    `java.lang.Exception` - Child was not found or was not unique.

### getOptionalChild

    public static org.w3c.dom.Element getOptionalChild(org.w3c.dom.Element element,
                                                       java.lang.String tagName)
                                                throws java.lang.Exception

  Gets the child of the specified element having the specified name. If the child with this name doesn't exist then null is returned instead.

  Parameters:
    `element` - the parent element
    `tagName` - the name of the desired child
  Returns:
    either the named child or null
  Throws:
    `java.lang.Exception`

### getOptionalChild

    public static org.w3c.dom.Element getOptionalChild(org.w3c.dom.Element element,
                                                       java.lang.String tagName,
                                                       org.w3c.dom.Element defaultElement)
                                                throws java.lang.Exception

  Gets the child of the specified element having the specified name. If the child with this name doesn't exist then the supplied default element is returned instead.

  Parameters:
    `element` - the parent element
    `tagName` - the name of the desired child
    `defaultElement` - the element to return if the child doesn't exist
  Returns:
    either the named child or the supplied default
  Throws:
    `java.lang.Exception`

### getElementContent

    public static java.lang.String getElementContent(org.w3c.dom.Element element)
                                              throws java.lang.Exception

  Get the content of the given element.

  Parameters:
    `element` - The element to get the content for.
  Returns:
    The content of the element or null.
  Throws:
    `java.lang.Exception`

### getElementContent

    public static java.lang.String getElementContent(org.w3c.dom.Element element,
                                                     java.lang.String defaultStr)
                                              throws java.lang.Exception

  Get the content of the given element.

  Parameters:
    `element` - The element to get the content for.
    `defaultStr` - The default to return when there is no content.
  Returns:
    The content of the element or the default.
  Throws:
    `java.lang.Exception`

### getUniqueChildContent

    public static java.lang.String getUniqueChildContent(org.w3c.dom.Element element,
                                                         java.lang.String tagName)
                                                  throws java.lang.Exception

  Macro to get the content of a unique child element.

  Parameters:
    `element` - The parent element.
    `tagName` - The name of the desired child.
  Returns:
    The element content or null.
  Throws:
    `java.lang.Exception`

### getOptionalChildContent

    public static java.lang.String getOptionalChildContent(org.w3c.dom.Element element,
                                                           java.lang.String tagName)
                                                    throws java.lang.Exception

  Macro to get the content of an optional child element.

  Parameters:
    `element` - The parent element.
    `tagName` - The name of the desired child.
  Returns:
    The element content or null.
  Throws:
    `java.lang.Exception`

### getOptionalChildBooleanContent

    public static boolean getOptionalChildBooleanContent(org.w3c.dom.Element element,
                                                         java.lang.String name)
                                                  throws java.lang.Exception

  Throws:
    `java.lang.Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD