public class XMLWriter extends Object
| Modifier and Type | Field and Description |
|---|---|
protected StringBuffer |
buffer
Buffer.
|
static int |
CLOSING
Closing tag.
|
protected boolean |
isRootElement
Is true until the root element is written
|
protected Map<String,String> |
namespaces
Namespaces to be declared in the root element
|
static int |
NO_CONTENT
Element with no content.
|
static int |
OPENING
Opening tag.
|
protected Writer |
writer
Writer.
|
| Constructor and Description |
|---|
XMLWriter(Map<String,String> namespaces) |
XMLWriter(Writer writer,
Map<String,String> namespaces) |
| 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 name,
int type)
Write an element.
|
void |
writeProperty(String name)
Write property to the XML.
|
void |
writeProperty(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 StringBuffer buffer
protected Writer writer
protected boolean isRootElement
public String toString()
public void writeProperty(String name, String value)
name - Property namevalue - Property valuepublic void writeProperty(String name)
name - Property namepublic void writeElement(String name, int type)
name - 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 © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.