public class DOMUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
XML_RESERVED_PREFIX |
Constructor and Description |
---|
DOMUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addToNamedList(Node nd,
NamedList nlst,
List arr)
Examines a Node from the DOM representation of a NamedList and adds the
contents of that node to both the specified NamedList and List passed
as arguments.
|
static List |
childNodesToList(Node nd) |
static NamedList<Object> |
childNodesToNamedList(Node nd) |
static String |
getAttr(NamedNodeMap attrs,
String name) |
static String |
getAttr(NamedNodeMap attrs,
String name,
String missing_err) |
static String |
getAttr(Node nd,
String name) |
static String |
getAttr(Node node,
String name,
String missing_err) |
static Node |
getChild(Node node,
String name) |
static String |
getText(Node nd)
Drop in replacement for Node.getTextContent().
|
static List |
nodesToList(NodeList nlst) |
static NamedList<Object> |
nodesToNamedList(NodeList nlst) |
static void |
substituteProperties(Node node,
Properties properties)
Replaces ${property[:default value]} references in all attributes
and text nodes of supplied node.
|
static String |
substituteProperty(String value,
Properties coreProperties) |
static void |
substituteSystemProperties(Node node)
Replaces ${system.property[:default value]} references in all attributes
and text nodes of supplied node.
|
static Map<String,String> |
toMap(NamedNodeMap attrs) |
static Map<String,String> |
toMapExcept(NamedNodeMap attrs,
String... exclusions) |
public static final String XML_RESERVED_PREFIX
public static Map<String,String> toMap(NamedNodeMap attrs)
public static Map<String,String> toMapExcept(NamedNodeMap attrs, String... exclusions)
public static String getAttr(NamedNodeMap attrs, String name)
public static String getAttr(NamedNodeMap attrs, String name, String missing_err)
public static void addToNamedList(Node nd, NamedList nlst, List arr)
nd
- The Node whose type will be used to determine how to parse the
text content. If there is a 'name' attribute it will be used
when adding to the NamedListnlst
- A NamedList to add the item to with name if application.
If this param is null it will be ignored.arr
- A List to add the item to.
If this param is null it will be ignored.public static String getText(Node nd)
This method is provided to support the same functionality as Node.getTextContent() but in a way that is DOM Level 2 compatible.
public static void substituteSystemProperties(Node node)
node
- DOM node to walk for substitutionspublic static void substituteProperties(Node node, Properties properties)
node
- DOM node to walk for substitutionsproperties
- the Properties instance from which a value can be looked uppublic static String substituteProperty(String value, Properties coreProperties)
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.