public class DOMUtil extends Object
This class was adapted from an O'Reilly site on DOM utilities. It contains a few helper methods to make extracting out XML text from DOM representations a little easier.
Constructor and Description |
---|
DOMUtil() |
Modifier and Type | Method and Description |
---|---|
static Element |
getFirstElement(Element element,
String name)
Method returns the First occurence of Element 'name' in the DOM Node
'element'.
|
static String |
getSimpleElementText(Element node)
*
|
static String |
getSimpleElementText(Element node,
String name)
*
|
public static Element getFirstElement(Element element, String name) throws CommonsException
Method returns the First occurence of Element 'name' in the DOM Node 'element'.
element
- The DOM Element node to traverse.name
- The XML name of the Element to return.CommonsException
public static String getSimpleElementText(Element node, String name) throws CommonsException
This function is intended when you have a DOM element with no other DOM
elements inside (i.e.
node
- The DOM 'SimpleElement' as defined in the Function definition.name
- The name of the Text to retreive.CommonsException
Copyright © 1999–2017 Apache OODT. All rights reserved.