public class XMLWriter extends Object
| Modifier and Type | Field and Description | 
|---|---|
protected StringBuilder | 
buffer
Buffer. 
 | 
static int | 
CLOSING
Closing tag. 
 | 
static int | 
NO_CONTENT
Element with no content. 
 | 
static int | 
OPENING
Opening tag. 
 | 
protected Writer | 
writer
Writer. 
 | 
| Constructor and Description | 
|---|
XMLWriter()
Constructor. 
 | 
XMLWriter(Writer writer)
Constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
sendData()
Send data and reinitializes buffer. 
 | 
String | 
toString()
Retrieve generated XML. 
 | 
void | 
writeData(String data)
Write data. 
 | 
void | 
writeElement(String namespace,
            String name,
            int type)
Write an element. 
 | 
void | 
writeElement(String namespace,
            String namespaceInfo,
            String name,
            int type)
Write an element. 
 | 
void | 
writeProperty(String namespace,
             String name)
Write property to the XML. 
 | 
void | 
writeProperty(String namespace,
             String name,
             String value)
Write property to the XML. 
 | 
void | 
writeProperty(String namespace,
             String namespaceInfo,
             String name,
             String value)
Write property to the XML. 
 | 
void | 
writeText(String text)
Write text. 
 | 
void | 
writeXMLHeader()
Write XML Header. 
 | 
public static final int OPENING
public static final int CLOSING
public static final int NO_CONTENT
protected StringBuilder buffer
protected Writer writer
public XMLWriter()
public XMLWriter(Writer writer)
public String toString()
public void writeProperty(String namespace, String namespaceInfo, String name, String value)
namespace - NamespacenamespaceInfo - Namespace infoname - Property namevalue - Property valuepublic void writeProperty(String namespace, String name, String value)
namespace - Namespacename - Property namevalue - Property valuepublic void writeProperty(String namespace, String name)
namespace - Namespacename - Property namepublic void writeElement(String namespace, String name, int type)
name - Element namenamespace - Namespace abbreviationtype - Element typepublic void writeElement(String namespace, String namespaceInfo, String name, int type)
namespace - Namespace abbreviationnamespaceInfo - Namespace infoname - Element nametype - Element typepublic void writeText(String text)
text - Text to appendpublic void writeData(String data)
data - Data to appendpublic void writeXMLHeader()
public void sendData()
              throws IOException
IOExceptionCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.