public class XmlHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
XML_ENCODING |
Constructor and Description |
---|
XmlHelper() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
checkElementText(java.lang.Object value) |
static java.lang.String |
closeElement(java.lang.String elementName)
Returns a close tag of XML element
|
static java.lang.String |
fixXMLString(java.lang.String string)
Fixes a string for use in XML
(replaces & with & < with > > with <
|
static java.lang.String |
flatPrintXml(Element element) |
static java.lang.String |
getEncoding() |
static java.lang.String |
getEncoding(java.lang.String encoding) |
static boolean |
isByteValid(int aByte) |
static boolean |
isXMLCharacter(char c)
This is a utility function for determining whether a specified
character is a character according to production 2 of the
XML 1.0 specification.
|
static Element |
loadRootElement(java.io.InputStream inStream) |
static Element |
loadRootElement(java.lang.String xmlData)
Parses XML string and returns its root element
|
static java.lang.String |
makeElement(java.lang.String elementName)
Builds string of empty XML element
|
static java.lang.String |
makeElement(java.lang.String elementName,
boolean value)
Builds string of XML element
|
static java.lang.String |
makeElement(java.lang.String elementName,
int value)
Builds string of XML element
|
static java.lang.String |
makeElement(java.lang.String elementName,
java.lang.Object value)
Builds string of XML element
|
static java.lang.String |
makeElement(java.lang.String elementName,
java.lang.Object value,
java.util.Collection attributes)
Builds string of XML element
|
static java.lang.String |
makeElement(java.lang.String elementName,
java.lang.Object value,
java.util.Map attributes)
Builds string of XML element
|
static java.lang.String |
openElement(java.lang.String elementName)
Returns an open tag of XML element
|
static java.lang.String |
openElement(java.lang.String elementName,
java.util.Collection attributes)
Returns an open tag of XML element
|
static java.lang.String |
openElement(java.lang.String elementName,
java.util.Map attributes)
Returns an open tag of XML element
|
static java.lang.String |
prettyPrintXml(Element element) |
static java.lang.String |
prettyPrintXml(Element element,
boolean normalizeText) |
static java.lang.String |
prettyPrintXml(Element element,
boolean normalizeText,
boolean setNewLines) |
static java.lang.String |
prettyPrintXml(Element element,
boolean normalizeText,
boolean setIdent,
boolean setNewLines) |
static java.lang.String |
toXmlString(Element element) |
static java.lang.String |
toXmlString(Element element,
java.lang.String encoding) |
public static java.lang.String checkElementText(java.lang.Object value)
public static boolean isXMLCharacter(char c)
c
- char
to check for XML compliance.boolean
- true if it's a character,
false otherwise.public static java.lang.String makeElement(java.lang.String elementName, java.lang.Object value, java.util.Map attributes)
elementName
- the element namevalue
- the element valueattributes
- the table of element attributespublic static java.lang.String makeElement(java.lang.String elementName, java.lang.Object value, java.util.Collection attributes)
elementName
- the element namevalue
- the element valueattributes
- the collection of element attributespublic static java.lang.String makeElement(java.lang.String elementName, java.lang.Object value)
elementName
- the element namevalue
- the element valuepublic static java.lang.String makeElement(java.lang.String elementName, int value)
elementName
- the element namevalue
- the element valuepublic static java.lang.String makeElement(java.lang.String elementName, boolean value)
elementName
- the element namevalue
- the element valuepublic static java.lang.String makeElement(java.lang.String elementName)
elementName
- the element namepublic static java.lang.String openElement(java.lang.String elementName, java.util.Map attributes)
elementName
- the element nameattributes
- the table of element attributespublic static java.lang.String openElement(java.lang.String elementName, java.util.Collection attributes)
elementName
- the element nameattributes
- the collection of element attributespublic static java.lang.String openElement(java.lang.String elementName)
elementName
- the element namepublic static java.lang.String closeElement(java.lang.String elementName)
elementName
- the element namepublic static java.lang.String getEncoding(java.lang.String encoding)
public static java.lang.String getEncoding()
public static java.lang.String toXmlString(Element element, java.lang.String encoding)
public static java.lang.String toXmlString(Element element)
public static java.lang.String prettyPrintXml(Element element)
public static java.lang.String prettyPrintXml(Element element, boolean normalizeText)
public static java.lang.String prettyPrintXml(Element element, boolean normalizeText, boolean setNewLines)
public static java.lang.String prettyPrintXml(Element element, boolean normalizeText, boolean setIdent, boolean setNewLines)
public static java.lang.String flatPrintXml(Element element)
public static boolean isByteValid(int aByte)
public static java.lang.String fixXMLString(java.lang.String string)
string
- public static Element loadRootElement(java.lang.String xmlData) throws java.io.IOException, JDOMException
xmlData
- xml data to parsejava.io.IOException
JDOMException
public static Element loadRootElement(java.io.InputStream inStream) throws java.io.IOException, JDOMException
java.io.IOException
JDOMException
Documentation Feedback
Copyright 2012 Micro Focus or one of its affiliates.