public final class XMLUtils
extends java.lang.Object
Class contains utilities for processing XML.
Project:Horizontal platform to generation signature reports in legible format.
| Modifier and Type | Method and Description |
|---|---|
static org.w3c.dom.Document |
getBlankDocument()
Creates a black document.
|
static org.w3c.dom.Document |
getDocument(byte[] xml)
Gets Document interface that represents the entire HTML or XML document.
|
static org.w3c.dom.Document |
getDocument(java.io.InputStream in)
Gets Document interface that represents the entire HTML or XML document.
|
static org.w3c.dom.NodeList |
getNodes(org.w3c.dom.Node xml,
java.lang.String xpath)
Get the list of nodes that meet the XPath condition provided.
|
static java.lang.String |
getNodeValue(org.w3c.dom.Node xml,
java.lang.String xpath)
Get the value of node located in the XPath supplied.
|
static byte[] |
getSOAP(javax.xml.soap.SOAPMessage msgSOAP)
Extracts the SOAP message include into
SOAPMessage object. |
static byte[] |
getXMLBytes(org.w3c.dom.Node xml)
Gets a XML as bytes array.
|
static void |
includeElementValue(org.w3c.dom.Document xml,
java.lang.String xpath,
java.lang.Object value,
int type)
Method that includes a DOM object into the XML supplied and in the indicated path.
|
static void |
removeNodes(org.w3c.dom.Document xml,
java.util.ArrayList<java.lang.String> nodesToRemove)
This method removes of the XML supplied the nodes indicated.
|
static byte[] |
xslTransform(byte[] xml,
byte[] xslt)
Method that returns the XML result of applying the XSL transformation to the data supplied.
|
public static org.w3c.dom.Document getBlankDocument()
throws UtilsException
UtilsException - If an error occurs.public static byte[] getSOAP(javax.xml.soap.SOAPMessage msgSOAP)
throws UtilsException
SOAPMessage object.msgSOAP - SOAP message.UtilsException - If an error occurs.public static byte[] xslTransform(byte[] xml,
byte[] xslt)
throws UtilsException
xml - XML input.xslt - XSL Transform.UtilsException - There was an error processing the XML.public static byte[] getXMLBytes(org.w3c.dom.Node xml)
throws UtilsException
xml - XML document.UtilsException - There was an error processing the XML.public static org.w3c.dom.NodeList getNodes(org.w3c.dom.Node xml,
java.lang.String xpath)
throws UtilsException
xml - Node where to search.xpath - XPath location of node to get.UtilsException - There was an error processing the XML.public static java.lang.String getNodeValue(org.w3c.dom.Node xml,
java.lang.String xpath)
throws UtilsException
xml - Node where to search.xpath - XPath location of node that planning to obtain the value.UtilsException - There was an error processing the XML.public static org.w3c.dom.Document getDocument(java.io.InputStream in)
throws UtilsException
in - InputStream containing the content to be parsed.UtilsException - There was an error processing the XML.public static org.w3c.dom.Document getDocument(byte[] xml)
throws UtilsException
xml - Array of bytes that contain the content to be parsed.UtilsException - There was an error processing the XML.public static void includeElementValue(org.w3c.dom.Document xml,
java.lang.String xpath,
java.lang.Object value,
int type)
throws UtilsException
xml - Document for including of element.xpath - Xpath that locates the node where will be included the element.value - Object that represents the element to be included. Allowed Object:String - If the object to include is a text node or a cdata section.Node - If the object to include is a element node.type - Parameter that indicates the type object to be included. Allowed values:Node.TEXT_NODE - If the object to include is a text node.Node.CDATA_SECTION_NODE - If the object to include is a cdata section.Node.ELEMENT_NODE - If the object to include is a element node.UtilsException - There was an error processing the XML.public static void removeNodes(org.w3c.dom.Document xml,
java.util.ArrayList<java.lang.String> nodesToRemove)
throws UtilsException
xml - Document for removing the nodes supplied.nodesToRemove - List of XPath that locate the nodes to remove.UtilsException - There was an error processing the XML.