Package org.alfresco.util
Class XMLUtil
- java.lang.Object
-
- org.alfresco.util.XMLUtil
-
public class XMLUtil extends Object
XML 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 StringbuildXPath(Node from, Element to)FOR DIAGNOSTIC PURPOSES ONLY - incomplete
Builds a path to the node relative to the to node provided.static NodeListcombine(NodeList... nls)Provides a NodeList of multiple nodelistsstatic DocumentBuildergetDocumentBuilder()provides a document builder that is namespace aware but not validating by defaultstatic DocumentBuildergetDocumentBuilder(boolean namespaceAware, boolean validating)static DocumentnewDocument()utility function for creating a documentstatic Documentparse(File source)utility function for parsing xmlstatic Documentparse(InputStream source)utility function for parsing xmlstatic Documentparse(Reader source)utility function for parsing xmlstatic Documentparse(String source)utility function for parsing xmlstatic Documentparse(NodeRef nodeRef, ContentService contentService)utility function for parsing xmlstatic voidprint(Node n, File output)utility function for serializing a nodestatic voidprint(Node n, Writer output)utility function for serializing a nodestatic voidprint(Node n, Writer output, boolean indent)utility function for serializing a nodestatic StringtoString(Node n)utility function for serializing a nodestatic StringtoString(Node n, boolean indent)utility function for serializing a node
-
-
-
Method Detail
-
newDocument
public static Document newDocument()
utility function for creating a document
-
print
public static void print(Node n, Writer output, boolean indent)
utility function for serializing a node
-
print
public static void print(Node n, File output) throws IOException
utility function for serializing a node- Throws:
IOException
-
toString
public static String toString(Node n, boolean indent)
utility function for serializing a node
-
parse
public static Document parse(String source) throws SAXException, IOException
utility function for parsing xml- Throws:
SAXExceptionIOException
-
parse
public static Document parse(NodeRef nodeRef, ContentService contentService) throws SAXException, IOException
utility function for parsing xml- Throws:
SAXExceptionIOException
-
parse
public static Document parse(File source) throws SAXException, IOException
utility function for parsing xml- Throws:
SAXExceptionIOException
-
parse
public static Document parse(InputStream source) throws SAXException, IOException
utility function for parsing xml- Throws:
SAXExceptionIOException
-
parse
public static Document parse(Reader source) throws SAXException, IOException
utility function for parsing xml- Throws:
SAXExceptionIOException
-
getDocumentBuilder
public static DocumentBuilder getDocumentBuilder()
provides a document builder that is namespace aware but not validating by default
-
buildXPath
public static String buildXPath(Node from, 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 DocumentBuilder getDocumentBuilder(boolean namespaceAware, boolean validating)
-
-