public class SimpleXml extends Object
SimpleXml class facilitates the creation of an XML document.| Modifier and Type | Class and Description |
|---|---|
class |
SimpleXml.Element
The
SimpleXml.Element reperesents an XML element. |
| Constructor and Description |
|---|
SimpleXml(PrintWriter w)
Creates a
SimpleXml instance using the specified
print writer for the output of the XML document. |
| Modifier and Type | Method and Description |
|---|---|
SimpleXml |
close()
Closes the most recent open element.
|
void |
closeDocument()
Closes the XML document after closing all open elements.
|
PrintWriter |
getWriter()
Returns the print writer used for the output of the XML document.
|
SimpleXml |
omitXmlDeclaration(boolean omit)
Defines whether the XML declaration should be omitted.
|
SimpleXml |
open()
Opens the XML document.
|
SimpleXml.Element |
open(String name)
Opens and returns a new XML element with the specified name.
|
SimpleXml.Element |
open(String localName,
String name)
Opens and returns a new XML element with the specified name.
|
SimpleXml.Element |
open(String name,
String content,
boolean cdata)
Opens and returns a new XML element with the specified name and content.
|
SimpleXml.Element |
open(String uri,
String localName,
String name)
Opens and returns a new XML element with the specified name.
|
SimpleXml |
openDocument()
Opens the XML document.
|
SimpleXml |
setDocumentLocator(Locator locator)
Sets the document locator of the output.
|
SimpleXml |
setEncoding(String encoding)
Sets the character encoding of the output.
|
SimpleXml |
setIndent(boolean indent)
Defines whether the output should use indetation.
|
SimpleXml |
tidyUp()
Closes all currently open elements.
|
public SimpleXml(PrintWriter w) throws IOException
SimpleXml instance using the specified
print writer for the output of the XML document.w - The writer to send the XML document toIOException - If initialization failspublic PrintWriter getWriter()
public SimpleXml setIndent(boolean indent)
true.indent - true if the output should use indentation,
false otherwisepublic SimpleXml setEncoding(String encoding)
UTF-8.encoding - The character encodingpublic SimpleXml omitXmlDeclaration(boolean omit)
false.omit - true if the XML declaration should be omitted,
false otherwisepublic SimpleXml setDocumentLocator(Locator locator)
locator - The document locatorpublic SimpleXml open() throws IOException
openDocument().IOException - If output failspublic SimpleXml openDocument() throws IOException
IOException - If output failspublic SimpleXml.Element open(String name) throws IOException
name - The name of the XML elementIOException - If output failspublic SimpleXml.Element open(String localName, String name) throws IOException
localName - The local name of the XML elementname - The name of the XML elementIOException - If output failspublic SimpleXml.Element open(String uri, String localName, String name) throws IOException
uri - The URI of the XML elementlocalName - The local name of the XML elementname - The name of the XML elementIOException - If output failspublic SimpleXml.Element open(String name, String content, boolean cdata) throws IOException
name - The name of the XML elementcontent - The content of the XML elementcdata - true if content should be in a CDATA block,
false otherwiseIOException - If output failspublic void closeDocument()
throws IOException
IOException - If output failspublic SimpleXml close() throws IOException
IOException - If output failspublic SimpleXml tidyUp() throws IOException
IOException - If output failsCopyright © 2010 - 2020 Adobe. All Rights Reserved