public class XmlUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CDATA_END
Character data section end.
|
static java.lang.String |
CDATA_START
Character data section start.
|
static java.lang.String |
EMPTY_STRING |
| Constructor and Description |
|---|
XmlUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
stringToXML(java.lang.String str)
Escapes chars for use in XML.
|
static void |
writeCDataTag(java.lang.String tagName,
java.lang.String tagValue,
java.io.BufferedWriter bout)
Writes an entire XML element (without attributes) to the output
stream - the data value is enclosed in a CDATA section.
|
static void |
writeCDataTag(java.lang.String tagName,
java.lang.String tagValue,
java.lang.StringBuffer bout)
Writes an entire XML element (without attributes) to the StringBuffer
- the data value is enclosed in a CDATA section.
|
static void |
writeEndTag(java.lang.String tagName,
java.io.BufferedWriter bout)
Writes an XML end tag to the output stream.
|
static void |
writeEndTag(java.lang.String tagName,
java.lang.StringBuffer bout)
Writes an XML end tag to the StringBuffer.
|
static void |
writeStartTag(java.lang.String tagName,
java.io.BufferedWriter bout)
Writes an XML start tag (without attributes) to the output stream.
|
static void |
writeStartTag(java.lang.String tagName,
java.util.Properties tagAttributes,
java.io.BufferedWriter bout)
Writes an XML start tag and associated attributes to the output stream.
|
static void |
writeStartTag(java.lang.String tagName,
java.util.Properties tagAttributes,
java.lang.StringBuffer bout)
Writes an XML start tag and associated attributes to the StringBuffer.
|
static void |
writeStartTag(java.lang.String tagName,
java.lang.StringBuffer bout)
Writes an XML start tag (without attributes) to the StringBuffer.
|
static void |
writeTag(java.lang.String tagName,
java.util.Properties tagAttributes,
java.lang.String tagValue,
java.io.BufferedWriter bout)
Writes an entire XML element with attributes to the output stream.
|
static void |
writeTag(java.lang.String tagName,
java.util.Properties tagAttributes,
java.lang.String tagValue,
java.io.BufferedWriter bout,
boolean bCData)
Writes an entire XML element to the output stream - the data value
is optionally enclosed in a CDATA section.
|
static void |
writeTag(java.lang.String tagName,
java.util.Properties tagAttributes,
java.lang.String tagValue,
java.lang.StringBuffer bout)
Writes an entire XML element to the StringBuffer.
|
static void |
writeTag(java.lang.String tagName,
java.util.Properties tagAttributes,
java.lang.String tagValue,
java.lang.StringBuffer bout,
boolean bCData)
Writes an entire XML element to the StringBuffer - the data value is
optionally enclosed in a CDATA section.
|
static void |
writeTag(java.lang.String tagName,
java.lang.String tagValue,
java.io.BufferedWriter bout)
Writes an entire XML element (without attributes) to the output stream.
|
static void |
writeTag(java.lang.String tagName,
java.lang.String tagValue,
java.lang.StringBuffer bout)
Writes an entire XML element (without attributes) to the StringBuffer.
|
static java.lang.String |
xmlDecode(java.lang.String str)
Decodes string that has been escape for XML.
|
static java.lang.String |
xmlDocumentToString(org.jdom.Document doc)
Convert a XML Document object to a String
|
static java.lang.String |
xmlDocumentToString(org.w3c.dom.Document doc)
Convert a XML Document object to a String
|
static java.lang.String |
xmlElementToString(org.w3c.dom.Element element)
Convert a XML Document object to a String
|
static java.lang.String |
xmlElementToString(org.jdom.Element element)
Convert a XML Document object to a String
|
static java.lang.String |
xmlEncode(java.lang.String strText)
Escapes chars for use in XML.
|
public static final java.lang.String CDATA_START
( CDATA_START = "<![CDATA[" )
public static final java.lang.String CDATA_END
CDATA_END = "]]>"
public static final java.lang.String EMPTY_STRING
public static void writeTag(java.lang.String tagName,
java.lang.String tagValue,
java.io.BufferedWriter bout)
throws java.io.IOException
Sample output:
<tagName>tagValue</tagName>
tagName - the tag nametagValue - the element data, may be nullbout - the output streamjava.io.IOException - on I/O errorpublic static void writeCDataTag(java.lang.String tagName,
java.lang.String tagValue,
java.io.BufferedWriter bout)
throws java.io.IOException
Sample output:
<tagName><![CDATA[tagValue]]></tagName>
tagName - the tag nametagValue - the element data, may be nullbout - the output streamjava.io.IOException - on I/O errorpublic static void writeTag(java.lang.String tagName,
java.util.Properties tagAttributes,
java.lang.String tagValue,
java.io.BufferedWriter bout)
throws java.io.IOException
Sample output:
<tagName attr1="val1" attr2="val2" ...>tagValue</tagName>
tagName - the tag nametagAttributes - a Properties object holding the attribute name/value pairs,
may be null if no attributestagValue - the element data, may be nullbout - the output streamjava.io.IOException - on I/O errorpublic static void writeTag(java.lang.String tagName,
java.util.Properties tagAttributes,
java.lang.String tagValue,
java.io.BufferedWriter bout,
boolean bCData)
throws java.io.IOException
Sample output:
<tagName attr1="val1" attr2="val2" ...>tagValue</tagName>
or
<tagName attr1="val1" attr2="val2" ...><![CDATA[tagValue]]></tagName>
tagName - the tag nametagAttributes - a Properties object holding the attribute name/value pairs,
may be null if no attributestagValue - the element data, may be nullbout - the output streambCData - true if the tagValue data requires a "<![CDATA[. . .]]>" wrapperjava.io.IOException - on I/O errorpublic static void writeStartTag(java.lang.String tagName,
java.io.BufferedWriter bout)
throws java.io.IOException
Sample output:
<tagName>
tagName - the tag namebout - the output streamjava.io.IOException - on I/O errorpublic static void writeStartTag(java.lang.String tagName,
java.util.Properties tagAttributes,
java.io.BufferedWriter bout)
throws java.io.IOException
Sample output:
<tagName attr1="val1" attr2="val2" ...>
tagName - the tag nametagAttributes - a Properties object holding the attribute name/value pairs,
may be null if no attributesbout - the output streamjava.io.IOException - on I/O errorpublic static void writeEndTag(java.lang.String tagName,
java.io.BufferedWriter bout)
throws java.io.IOException
Sample output:
</tagName>
tagName - the tag namebout - the output streamjava.io.IOException - on I/O errorpublic static void writeTag(java.lang.String tagName,
java.lang.String tagValue,
java.lang.StringBuffer bout)
Sample output:
<tagName>tagValue</tagName>
tagName - the tag nametagValue - the element data, may be nullbout - the StringBufferpublic static void writeCDataTag(java.lang.String tagName,
java.lang.String tagValue,
java.lang.StringBuffer bout)
Sample output:
<tagName><![CDATA[tagValue]]></tagName>
tagName - the tag nametagValue - the element data, may be nullbout - the StringBufferpublic static void writeTag(java.lang.String tagName,
java.util.Properties tagAttributes,
java.lang.String tagValue,
java.lang.StringBuffer bout)
Sample output:
<tagName attr1="val1" attr2="val2" ...>tagValue</tagName>
tagName - the tag nametagAttributes - a Properties object holding the attribute name/value pairs,
may be null if no attributestagValue - the element data, may be nullbout - the StringBufferpublic static void writeTag(java.lang.String tagName,
java.util.Properties tagAttributes,
java.lang.String tagValue,
java.lang.StringBuffer bout,
boolean bCData)
Sample output:
<tagName attr1="val1" attr2="val2" ...>tagValue</tagName>
or
<tagName attr1="val1" attr2="val2" ...><![CDATA[tagValue]]></tagName>
tagName - the tag nametagAttributes - a Properties object holding the attribute name/value pairs,
may be null if no attributestagValue - the element data, may be nullbout - the StringBufferbCData - true if the tagValue data requires a "<![CDATA[. . .]]>" wrapperpublic static void writeStartTag(java.lang.String tagName,
java.lang.StringBuffer bout)
Sample output:
<tagName>
tagName - the tag namebout - the StringBufferpublic static void writeStartTag(java.lang.String tagName,
java.util.Properties tagAttributes,
java.lang.StringBuffer bout)
Sample output:
<tagName attr1="val1" attr2="val2" ...>
tagName - the tag nametagAttributes - a Properties object holding the attribute name/value pairs,
may be null if no attributesbout - the StringBufferpublic static void writeEndTag(java.lang.String tagName,
java.lang.StringBuffer bout)
Sample output:
</tagName>
tagName - the tag namebout - the StringBufferpublic static java.lang.String xmlDocumentToString(org.jdom.Document doc)
Document - XML Document to convert to a Stringpublic static java.lang.String xmlDocumentToString(org.w3c.dom.Document doc)
Document - XML Document to convert to a Stringpublic static java.lang.String xmlElementToString(org.w3c.dom.Element element)
Document - XML Document to convert to a Stringpublic static java.lang.String xmlElementToString(org.jdom.Element element)
Document - XML Document to convert to a Stringpublic static java.lang.String xmlDecode(java.lang.String str)
str - String to decodepublic static java.lang.String xmlEncode(java.lang.String strText)
strText - String to escapepublic static java.lang.String stringToXML(java.lang.String str)
str - String to escape
API Documentation Copyright © 1998-2004 Novell, Inc. All rights reserved.
NDS is a registered trademark of Novell, Inc. in the United States and other countries.
Generated ${TODAY} ${TSTAMP}.