public class SimpleXml
extends java.lang.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(java.io.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.
|
java.io.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(java.lang.String name)
Opens and returns a new XML element with the specified name.
|
SimpleXml.Element |
open(java.lang.String localName,
java.lang.String name)
Opens and returns a new XML element with the specified name.
|
SimpleXml.Element |
open(java.lang.String name,
java.lang.String content,
boolean cdata)
Opens and returns a new XML element with the specified name and content.
|
SimpleXml.Element |
open(java.lang.String uri,
java.lang.String localName,
java.lang.String name)
Opens and returns a new XML element with the specified name.
|
SimpleXml |
openDocument()
Opens the XML document.
|
SimpleXml |
setDocumentLocator(org.xml.sax.Locator locator)
Sets the document locator of the output.
|
SimpleXml |
setEncoding(java.lang.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(java.io.PrintWriter w) throws java.io.IOException
SimpleXml
instance using the specified
print writer for the output of the XML document.w
- The writer to send the XML document tojava.io.IOException
- If initialization failspublic java.io.PrintWriter getWriter()
public SimpleXml setIndent(boolean indent)
true
.indent
- true
if the output should use indentation,
false
otherwisepublic SimpleXml setEncoding(java.lang.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(org.xml.sax.Locator locator)
locator
- The document locatorpublic SimpleXml open() throws java.io.IOException
openDocument()
.java.io.IOException
- If output failspublic SimpleXml openDocument() throws java.io.IOException
java.io.IOException
- If output failspublic SimpleXml.Element open(java.lang.String name) throws java.io.IOException
name
- The name of the XML elementjava.io.IOException
- If output failspublic SimpleXml.Element open(java.lang.String localName, java.lang.String name) throws java.io.IOException
localName
- The local name of the XML elementname
- The name of the XML elementjava.io.IOException
- If output failspublic SimpleXml.Element open(java.lang.String uri, java.lang.String localName, java.lang.String name) throws java.io.IOException
uri
- The URI of the XML elementlocalName
- The local name of the XML elementname
- The name of the XML elementjava.io.IOException
- If output failspublic SimpleXml.Element open(java.lang.String name, java.lang.String content, boolean cdata) throws java.io.IOException
name
- The name of the XML elementcontent
- The content of the XML elementcdata
- true
if content should be in a CDATA block,
false
otherwisejava.io.IOException
- If output failspublic void closeDocument() throws java.io.IOException
java.io.IOException
- If output failspublic SimpleXml close() throws java.io.IOException
java.io.IOException
- If output failspublic SimpleXml tidyUp() throws java.io.IOException
java.io.IOException
- If output failsCopyright © 2010 - 2020 Adobe. All Rights Reserved