Package org.alfresco.util
Class XMLUtil
- java.lang.Object
-
- org.alfresco.util.XMLUtil
-
public class XMLUtil extends java.lang.ObjectXML utility functions.- Author:
- Ariel Backenroth
-
-
Constructor Summary
Constructors Constructor Description XMLUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringbuildXPath(org.w3c.dom.Node from, org.w3c.dom.Element to)FOR DIAGNOSTIC PURPOSES ONLY - incomplete
Builds a path to the node relative to the to node provided.static org.w3c.dom.NodeListcombine(org.w3c.dom.NodeList... nls)Provides a NodeList of multiple nodelistsstatic javax.xml.parsers.DocumentBuildergetDocumentBuilder()provides a document builder that is namespace aware but not validating by defaultstatic javax.xml.parsers.DocumentBuildergetDocumentBuilder(boolean namespaceAware, boolean validating)static org.w3c.dom.DocumentnewDocument()utility function for creating a documentstatic org.w3c.dom.Documentparse(java.io.File source)utility function for parsing xmlstatic org.w3c.dom.Documentparse(java.io.InputStream source)utility function for parsing xmlstatic org.w3c.dom.Documentparse(java.io.Reader source)utility function for parsing xmlstatic org.w3c.dom.Documentparse(java.lang.String source)utility function for parsing xmlstatic org.w3c.dom.Documentparse(org.alfresco.service.cmr.repository.NodeRef nodeRef, ContentService contentService)utility function for parsing xmlstatic voidprint(org.w3c.dom.Node n, java.io.File output)utility function for serializing a nodestatic voidprint(org.w3c.dom.Node n, java.io.Writer output)utility function for serializing a nodestatic voidprint(org.w3c.dom.Node n, java.io.Writer output, boolean indent)utility function for serializing a nodestatic java.lang.StringtoString(org.w3c.dom.Node n)utility function for serializing a nodestatic java.lang.StringtoString(org.w3c.dom.Node n, boolean indent)utility function for serializing a node
-
-
-
Method Detail
-
newDocument
public static org.w3c.dom.Document newDocument()
utility function for creating a document
-
print
public static void print(org.w3c.dom.Node n, java.io.Writer output)utility function for serializing a node
-
print
public static void print(org.w3c.dom.Node n, java.io.Writer output, boolean indent)utility function for serializing a node
-
print
public static void print(org.w3c.dom.Node n, java.io.File output) throws java.io.IOExceptionutility function for serializing a node- Throws:
java.io.IOException
-
toString
public static java.lang.String toString(org.w3c.dom.Node n)
utility function for serializing a node
-
toString
public static java.lang.String toString(org.w3c.dom.Node n, boolean indent)utility function for serializing a node
-
parse
public static org.w3c.dom.Document parse(java.lang.String source) throws org.xml.sax.SAXException, java.io.IOExceptionutility function for parsing xml- Throws:
org.xml.sax.SAXExceptionjava.io.IOException
-
parse
public static org.w3c.dom.Document parse(org.alfresco.service.cmr.repository.NodeRef nodeRef, ContentService contentService) throws org.xml.sax.SAXException, java.io.IOExceptionutility function for parsing xml- Throws:
org.xml.sax.SAXExceptionjava.io.IOException
-
parse
public static org.w3c.dom.Document parse(java.io.File source) throws org.xml.sax.SAXException, java.io.IOExceptionutility function for parsing xml- Throws:
org.xml.sax.SAXExceptionjava.io.IOException
-
parse
public static org.w3c.dom.Document parse(java.io.InputStream source) throws org.xml.sax.SAXException, java.io.IOExceptionutility function for parsing xml- Throws:
org.xml.sax.SAXExceptionjava.io.IOException
-
parse
public static org.w3c.dom.Document parse(java.io.Reader source) throws org.xml.sax.SAXException, java.io.IOExceptionutility function for parsing xml- Throws:
org.xml.sax.SAXExceptionjava.io.IOException
-
getDocumentBuilder
public static javax.xml.parsers.DocumentBuilder getDocumentBuilder()
provides a document builder that is namespace aware but not validating by default
-
buildXPath
public static java.lang.String buildXPath(org.w3c.dom.Node from, org.w3c.dom.Element to)FOR DIAGNOSTIC PURPOSES ONLY - incomplete
Builds a path to the node relative to the to node provided.- Parameters:
from- the node from which to build the xpathto- an ancestor of from which will be the root of the path- Returns:
- an xpath to to rooted at from.
-
getDocumentBuilder
public static javax.xml.parsers.DocumentBuilder getDocumentBuilder(boolean namespaceAware, boolean validating)
-
combine
public static org.w3c.dom.NodeList combine(org.w3c.dom.NodeList... nls)
Provides a NodeList of multiple nodelists
-
-