public class XMLUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
XML_INDENT_CHAR |
Constructor and Description |
---|
XMLUtils() |
Modifier and Type | Method and Description |
---|---|
static org.jdom.Document |
convertBytesToDocument(byte[] byteData)
Convert Bytes to Document object
|
static org.jdom.Element |
convertBytesToElement(byte[] byteData) |
static byte[] |
convertDocumentToBytes(org.jdom.Document doc)
Convert Document to byte array
|
static byte[] |
convertElementToBytes(org.jdom.Element elem) |
static java.lang.String |
convertElementToString(org.jdom.Element elem) |
static org.jdom.Document |
convertXMLStringToDocument(java.lang.String xmlStr,
java.lang.String encoding)
Convert XML string to document object to process fixed data.
|
static java.util.List |
copyContent(org.jdom.Element parentElem)
Will copy the content of an Element.
|
static org.jdom.Document |
getResourceAsDocument(java.lang.String resource) |
static byte[] |
prettyPrintXML(byte[] xml) |
static java.lang.String |
prettyPrintXML(org.jdom.Element element)
Pretty print a single element.
|
static byte[] |
readBinaryData(java.io.InputStream input) |
static byte[] |
readXMLFileToBytes(java.lang.String filepath)
Read XML file to process data.
|
static org.jdom.Document |
readXMLFileToDocument(java.lang.String filepath)
Read XML file to process data.
|
static void |
writeBytesToXMLFile(byte[] in,
java.io.File filepath,
boolean prettyPrint)
Write XML to the file
|
static void |
writeBytesToXMLFile(byte[] in,
java.lang.String filepath)
Write all XML records to the file
|
static void |
writeBytesToXMLFile(byte[] in,
java.lang.String filepath,
boolean prettyPrint)
Write XML to the file
|
static void |
writeBytesToXMLFile(byte[] in,
java.lang.String filepath,
java.lang.String top)
Deprecated.
|
static void |
writeDocumentToXMLFile(org.jdom.Document doc,
java.lang.String filepath) |
static void |
writeDocumentToXMLFile(org.jdom.Document doc,
java.lang.String filepath,
java.lang.String filebackup)
Deprecated.
|
public static final java.lang.String XML_INDENT_CHAR
public static java.util.List copyContent(org.jdom.Element parentElem)
parentElem
- public static byte[] readXMLFileToBytes(java.lang.String filepath) throws MXException
filepath
- Give path of the file.MXSystemException
- MAXIMO exceptionMXException
public static byte[] convertElementToBytes(org.jdom.Element elem) throws MXException
MXException
public static java.lang.String convertElementToString(org.jdom.Element elem) throws MXException
MXException
public static org.jdom.Element convertBytesToElement(byte[] byteData) throws MXException
MXException
public static byte[] convertDocumentToBytes(org.jdom.Document doc) throws MXException
doc
- Give reference to Document.MXSystemException
- MAXIMO exceptionMXException
public static org.jdom.Document getResourceAsDocument(java.lang.String resource) throws java.lang.Exception
java.lang.Exception
public static org.jdom.Document readXMLFileToDocument(java.lang.String filepath) throws MXException
filepath
- Give path of the file.MXSystemException
- MAXIMO exceptionMXException
public static org.jdom.Document convertBytesToDocument(byte[] byteData) throws MXException
byteData
- Give path of the file.MXSystemException
- MAXIMO exceptionMXException
public static org.jdom.Document convertXMLStringToDocument(java.lang.String xmlStr, java.lang.String encoding) throws MXException
xmlStr
- The XML in text format.encoding
- The encoding.MXApplicationException
- MAXIMO exceptionMXException
@Deprecated public static void writeDocumentToXMLFile(org.jdom.Document doc, java.lang.String filepath, java.lang.String filebackup) throws MXException
in
- Give reference to values object.filepath
- Give path of the file.filebackup
- Give path of the buckup file.top
- Give name of top level.MXException
- MAXIMO exceptionpublic static void writeDocumentToXMLFile(org.jdom.Document doc, java.lang.String filepath) throws MXException
MXException
@Deprecated public static void writeBytesToXMLFile(byte[] in, java.lang.String filepath, java.lang.String top) throws MXException
in
- Give reference to values object.filepath
- Give path of the file.top
- Give name of top level.MXException
- MAXIMO exceptionpublic static byte[] prettyPrintXML(byte[] xml) throws MXException
MXException
public static void writeBytesToXMLFile(byte[] in, java.lang.String filepath) throws MXException
in
- Give reference to values object.filepath
- Give path of the file.MXException
- MAXIMO exceptionpublic static void writeBytesToXMLFile(byte[] in, java.io.File filepath, boolean prettyPrint) throws MXException
in
- Give reference to values object.filepath
- Give path of the file, includes the file name.prettyPrint
- When set, formats the file for reading by people.MXException
public static void writeBytesToXMLFile(byte[] in, java.lang.String filepath, boolean prettyPrint) throws MXException
in
- Give reference to values object.filepath
- Give path of the file, includes the file name.prettyPrint
- When set, formats the file for reading by people.MXException
public static java.lang.String prettyPrintXML(org.jdom.Element element) throws MXException
MXException
public static byte[] readBinaryData(java.io.InputStream input) throws java.io.IOException
java.io.IOException