public class XMLUpdateUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String | ATTR_NAME_ENC
The encoding attribute name of an XML declaration.
|
static java.lang.String | CLASSNAME
The full class name for this file.
|
static java.lang.String | COPYRIGHT
Copyright statement.
|
Constructor and Description |
---|
XMLUpdateUtil() |
Modifier and Type | Method and Description |
---|---|
static void | appendChild(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, org.w3c.dom.Node newNode)
Appends a child node to the node(s) in a node list.
|
static void | appendChild(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.Node newNode)
Appends a child node to the node(s) pointed to by the XPath.
|
static void | appendChild(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.NodeList newNodes)
Appends a set of nodes to the node(s) pointed to by the XPath.
|
static void | appendString(org.w3c.dom.Document doc, java.lang.String path, java.lang.String value)
Appends a string to the node(s) pointed to by the XPath.
|
static void | appendString(org.w3c.dom.NodeList matchedNodeList, java.lang.String value)
Appends a string to the node(s) in a node list.
|
static int | countMatches(org.w3c.dom.Document doc, java.lang.String path)
Returns the number of XPath matches in the DOM tree.
|
static void | delete(org.w3c.dom.Document doc, java.lang.String path)
Removes the node(s) pointed to by the XPath.
|
static void | delete(org.w3c.dom.NodeList matchedNodeList)
Removes the nodes present in list of nodes indicated by matchedNodeList
|
static boolean | escapeEntityReferences(java.io.File xmlFile)
Escapes entity references in an XML file.
|
static boolean | escapeEntityReferences(java.io.File inputFile, java.io.File outputFile)
Reads content of an input XML file, escapes entity references, and writes the modified content to another XML file.
|
static java.lang.String | getEncoding(java.io.File xmlFile)
Returns the encoding of an XML file.
|
static java.lang.String | getEscapedAmp()
Returns the escaped '&' string.
|
static java.lang.String | getXMLDeclaration(java.io.File xmlFile)
Returns the XML declaration string in an XML file.
|
static void | insertAfter(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, org.w3c.dom.Node newNode)
Inserts a node after a list of node(s).
|
static void | insertAfter(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, org.w3c.dom.NodeList newNodes)
Inserts a set of node after a list of node(s).
|
static void | insertAfter(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.Node newNode)
Inserts a node after the node(s) pointed to by the XPath.
|
static void | insertAfter(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.NodeList newNodes)
Inserts a set of node after the node(s) pointed to by the XPath.
|
static void | insertBefore(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, org.w3c.dom.Node newNode)
Inserts a node before a list of node(s) that match XPath as siblings.
|
static void | insertBefore(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, org.w3c.dom.NodeList newNodes)
Inserts a set of node before a list of node(s).
|
static void | insertBefore(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.Node newNode)
Inserts a node before the node(s) pointed to by the XPath.
|
static void | insertBefore(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.NodeList newNodes)
Inserts a set of node before the node(s) pointed to by the XPath.
|
static void | insertCommentAfter(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, java.lang.String comment)
Inserts a comment after the node(s) pointed to by the XPath.
|
static void | insertCommentBefore(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, java.lang.String comment)
Inserts a comment before the node(s) pointed to by the XPath.
|
static boolean | matches(org.w3c.dom.Document doc, java.lang.String path)
Checks whether a given XPath matches any node in the DOM tree.
|
static org.w3c.dom.Document | readXMLFile(java.io.File inputFile)
Reads an XML file and returns its DOM representation.
|
static org.w3c.dom.Document | readXMLFile(java.io.File inputFile, java.lang.String encoding)
Reads an XML file and returns its DOM representation.
|
static void | replace(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, org.w3c.dom.Node newNode)
Replace the node(s) in a node list with the new node that match XPath with Nodes.
|
static void | replace(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, org.w3c.dom.NodeList newNodes)
Replaces the node(s) in a list with the new list of nodes.
|
static void | replace(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.Node newNode)
Replaces the node(s) pointed to by the XPath with the new node.
|
static void | replace(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.NodeList newNodes)
Replaces the node(s) pointed to by the XPath with the new list of nodes.
|
static org.w3c.dom.NodeList | selectNodeList(org.w3c.dom.Document doc, java.lang.String path)
Returns a list of matched node(s) pointed to by the XPath.
|
static java.lang.String | serializeToString(org.w3c.dom.Document doc, org.apache.xml.serialize.OutputFormat of)
Serializes a DOM to a string.
|
static java.lang.String | serializeToString(org.w3c.dom.Document doc, java.lang.String encoding, boolean indenting)
Serializes a DOM to a string.
|
static void | setAttribute(org.w3c.dom.Document doc, java.lang.String path, java.lang.String name, java.lang.String value)
Sets an attribute in the node(s) pointed to by the XPath.
|
static void | setAttribute(org.w3c.dom.NodeList matchedNodeList, java.lang.String name, java.lang.String value)
Sets an attribute in the node(s) in a node list.
|
static boolean | unescapeEntityReferences(java.io.File inputFile)
Unescapes entity references in an XML file.
|
static boolean | unescapeEntityReferences(java.io.File inputFile, java.io.File outputFile)
Reads content of an input XML file, unescapes entity references, and writes the modified content to another XML file.
|
static void | writeXMLFile(org.w3c.dom.Document doc, java.io.File outputFile, org.apache.xml.serialize.OutputFormat of)
Writes a DOM to a file.
|
static void | writeXMLFile(org.w3c.dom.Document doc, java.io.File outputFile, java.lang.String encoding, boolean indenting)
Writes a DOM to a file.
|
public static final java.lang.String COPYRIGHT
public static final java.lang.String CLASSNAME
public static final java.lang.String ATTR_NAME_ENC
public static void appendChild(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, org.w3c.dom.Node newNode)
public static void appendChild(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.Node newNode) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static void appendChild(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.NodeList newNodes) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static void delete(org.w3c.dom.NodeList matchedNodeList)
public static void delete(org.w3c.dom.Document doc, java.lang.String path) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static void insertBefore(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, org.w3c.dom.Node newNode)
public static void insertBefore(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.Node newNode) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static void insertBefore(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, org.w3c.dom.NodeList newNodes) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static void insertBefore(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.NodeList newNodes) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static void insertAfter(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, org.w3c.dom.Node newNode) throws javax.xml.transform.TransformerException
public static void insertAfter(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.Node newNode) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static void insertAfter(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, org.w3c.dom.NodeList newNodes) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static void insertAfter(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.NodeList newNodes) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static void replace(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, org.w3c.dom.Node newNode) throws javax.xml.transform.TransformerException
public static void replace(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.Node newNode) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static void replace(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, org.w3c.dom.NodeList newNodes) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static void replace(org.w3c.dom.Document doc, java.lang.String path, org.w3c.dom.NodeList newNodes) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static void appendString(org.w3c.dom.NodeList matchedNodeList, java.lang.String value) throws javax.xml.transform.TransformerException
public static void appendString(org.w3c.dom.Document doc, java.lang.String path, java.lang.String value) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static void setAttribute(org.w3c.dom.NodeList matchedNodeList, java.lang.String name, java.lang.String value) throws javax.xml.transform.TransformerException
public static void setAttribute(org.w3c.dom.Document doc, java.lang.String path, java.lang.String name, java.lang.String value) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static void insertCommentBefore(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, java.lang.String comment) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static void insertCommentAfter(org.w3c.dom.Document doc, org.w3c.dom.NodeList matchedNodeList, java.lang.String comment) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static boolean matches(org.w3c.dom.Document doc, java.lang.String path) throws javax.xml.transform.TransformerException
public static int countMatches(org.w3c.dom.Document doc, java.lang.String path) throws javax.xml.transform.TransformerException
public static org.w3c.dom.NodeList selectNodeList(org.w3c.dom.Document doc, java.lang.String path) throws javax.xml.transform.TransformerException, NoXPathMatchException
public static java.lang.String getEncoding(java.io.File xmlFile) throws java.io.IOException
public static java.lang.String getXMLDeclaration(java.io.File xmlFile) throws java.io.IOException
public static boolean escapeEntityReferences(java.io.File xmlFile) throws java.io.IOException
public static boolean escapeEntityReferences(java.io.File inputFile, java.io.File outputFile) throws java.io.IOException
public static boolean unescapeEntityReferences(java.io.File inputFile) throws java.io.IOException
public static boolean unescapeEntityReferences(java.io.File inputFile, java.io.File outputFile) throws java.io.IOException
public static java.lang.String getEscapedAmp()
public static org.w3c.dom.Document readXMLFile(java.io.File inputFile) throws java.io.IOException, org.xml.sax.SAXException
public static org.w3c.dom.Document readXMLFile(java.io.File inputFile, java.lang.String encoding) throws java.io.IOException, org.xml.sax.SAXException
public static void writeXMLFile(org.w3c.dom.Document doc, java.io.File outputFile, java.lang.String encoding, boolean indenting) throws java.io.IOException
public static void writeXMLFile(org.w3c.dom.Document doc, java.io.File outputFile, org.apache.xml.serialize.OutputFormat of) throws java.io.IOException
public static java.lang.String serializeToString(org.w3c.dom.Document doc, java.lang.String encoding, boolean indenting) throws java.io.IOException
public static java.lang.String serializeToString(org.w3c.dom.Document doc, org.apache.xml.serialize.OutputFormat of) throws java.io.IOException