Package org.craftercms.core.util
Class XmlUtils
java.lang.Object
org.craftercms.core.util.XmlUtils
- Author:
- Sumer Jabri, Alfonso Vásquez
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdocumentToPrettyString(org.dom4j.Document document) Returns the given document as a XML string in a "pretty" format.static List<org.dom4j.Node>selectNodes(org.dom4j.Node node, String xpathQuery, Map<String, String> namespaceUris) Executes the specified namespace aware XPath query as a multiple node query, returning the resulting list of nodes.selectNodeValues(org.dom4j.Node node, String xpathQuery) Executes the specified XPath query as a multiple node query, returning the text values of the resulting list of nodes.selectNodeValues(org.dom4j.Node node, String xpathQuery, Map<String, String> namespaceUris) Executes the specified namespace aware XPath query as a multiple node query, returning the text values of the resulting list of nodes.static ObjectselectObject(org.dom4j.Node node, String xpathQuery) Executes an XPath query to retrieve an object.static org.dom4j.NodeselectSingleNode(org.dom4j.Node node, String xpathQuery, Map<String, String> namespaceUris) Executes the specified namespace aware XPath query as a single node query, returning the resulting single node.static StringselectSingleNodeValue(org.dom4j.Node node, String xpathQuery) Executes the specified XPath query as a single node query, returning the text value of the resulting single node.static StringselectSingleNodeValue(org.dom4j.Node node, String xpathQuery, Map<String, String> namespaceUris) Executes the specified namespace aware XPath query as a single node query, returning the text value of the resulting single node.
-
Constructor Details
-
XmlUtils
public XmlUtils()
-
-
Method Details
-
selectObject
Executes an XPath query to retrieve an object. Normally, if the XPath result doesn't have a result, an empty collection is returned. This object checks that case and returns null accordingly. -
selectSingleNodeValue
Executes the specified XPath query as a single node query, returning the text value of the resulting single node. -
selectSingleNodeValue
public static String selectSingleNodeValue(org.dom4j.Node node, String xpathQuery, Map<String, String> namespaceUris) Executes the specified namespace aware XPath query as a single node query, returning the text value of the resulting single node. -
selectNodeValues
Executes the specified XPath query as a multiple node query, returning the text values of the resulting list of nodes. -
selectNodeValues
public static List<String> selectNodeValues(org.dom4j.Node node, String xpathQuery, Map<String, String> namespaceUris) Executes the specified namespace aware XPath query as a multiple node query, returning the text values of the resulting list of nodes. -
selectSingleNode
public static org.dom4j.Node selectSingleNode(org.dom4j.Node node, String xpathQuery, Map<String, String> namespaceUris) Executes the specified namespace aware XPath query as a single node query, returning the resulting single node. -
selectNodes
public static List<org.dom4j.Node> selectNodes(org.dom4j.Node node, String xpathQuery, Map<String, String> namespaceUris) Executes the specified namespace aware XPath query as a multiple node query, returning the resulting list of nodes. -
documentToPrettyString
Returns the given document as a XML string in a "pretty" format.- Parameters:
document-- Returns:
- the document as an XML string
-