Package org.apache.solr.common.util
Class DOMUtil
java.lang.Object
org.apache.solr.common.util.DOMUtil
XML DOM utilities
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidExamines 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.childNodesToList(Node nd) static StringgetAttr(NamedNodeMap attrs, String name) static StringgetAttr(NamedNodeMap attrs, String name, String missing_err) static Stringstatic Stringstatic StringgetAttrOrDefault(Node nd, String name, String def) static Nodestatic StringDrop in replacement for Node.getTextContent().nodesToList(NodeList nlst) nodesToNamedList(NodeList nlst) static Objectstatic voidsubstituteProperties(Node node, Properties properties) Replaces ${property[:default value]} references in all attributes and text nodes of supplied node.static StringsubstituteProperty(String value, Properties coreProperties) static voidReplaces ${system.property[:default value]} references in all attributes and text nodes of supplied node.toMap(NamedNodeMap attrs) toMapExcept(NamedNodeMap attrs, String... exclusions)
-
Field Details
-
XML_RESERVED_PREFIX
- See Also:
-
NL_TAGS
-
-
Constructor Details
-
DOMUtil
public DOMUtil()
-
-
Method Details
-
toMap
-
toMapExcept
-
getChild
-
getAttr
-
getAttr
-
getAttrOrDefault
-
getAttr
-
getAttr
-
childNodesToNamedList
-
childNodesToList
-
nodesToNamedList
-
nodesToList
-
addToNamedList
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.- Parameters:
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.
-
parseVal
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
getText
Drop in replacement for Node.getTextContent().This method is provided to support the same functionality as Node.getTextContent() but in a way that is DOM Level 2 compatible.
- See Also:
-
substituteSystemProperties
Replaces ${system.property[:default value]} references in all attributes and text nodes of supplied node. If the system property is not defined and no default value is provided, a runtime exception is thrown.- Parameters:
node- DOM node to walk for substitutions
-
substituteProperties
Replaces ${property[:default value]} references in all attributes and text nodes of supplied node. If the property is not defined, either in the given Properties instance nor in System.getProperty and no default value is provided, a runtime exception is thrown.- Parameters:
node- DOM node to walk for substitutionsproperties- the Properties instance from which a value can be looked up
-
substituteProperty
-