Constructor and Description |
---|
XMLWriter(PrintWriter out)
Constructs an XML writer.
|
Modifier and Type | Method and Description |
---|---|
void |
beginElement(String tag)
Writes the begin tag for an element.
|
void |
beginElement(String tag,
String attributes)
Writes the begin tag for an element with attributes.
|
void |
close()
Closes the output writer.
|
void |
element(String tag,
String content)
Writes an element with text content.
|
void |
emptyElement(String tag,
String attributes)
Writes an empty element with attributes.
|
void |
endAllElements()
Write the end tag for all open elements.
|
void |
endElement()
Writes the end tag for the current element.
|
static String |
escape(String x)
Replaces the special XML characters a text string with their predefined entities.
|
NamespaceWriter |
lookup(String namespace)
Looks up a namespace writer for this XML writer.
|
void |
register(NamespaceWriter writer)
Registers a namespace writer for this XML writer.
|
void |
write(String tag,
boolean value)
Writes a boolean element.
|
void |
write(String tag,
Boolean o)
Writes a Boolean element if non-null.
|
void |
write(String tag,
int value)
Writes an int element.
|
void |
write(String tag,
NCName ncname)
Writes an NCName element if non-null.
|
void |
write(String tag,
String content)
Writes a String element if non-null.
|
void |
xmlDeclaration(String encoding)
Writes the XML declaration.
|
public XMLWriter(PrintWriter out)
out
- the output writerpublic void close()
public void xmlDeclaration(String encoding)
encoding
- the character encoding or nullpublic void beginElement(String tag)
tag
- the tagpublic void beginElement(String tag, String attributes)
tag
- the tagattributes
- the attributespublic void endElement()
public void endAllElements()
public void element(String tag, String content)
tag
- the tagcontent
- the contentpublic void emptyElement(String tag, String attributes)
tag
- the tagattributes
- the attributespublic void write(String tag, NCName ncname)
tag
- the tagncname
- the NCName object or nullpublic void write(String tag, String content)
tag
- the tagcontent
- the String object or nullpublic void write(String tag, Boolean o)
tag
- the tago
- the Boolean object or nullpublic void write(String tag, boolean value)
tag
- the tagvalue
- the boolean valuepublic void write(String tag, int value)
tag
- the tagvalue
- the int valuepublic static String escape(String x)
x
- the textpublic void register(NamespaceWriter writer)
writer
- the namespace writerpublic NamespaceWriter lookup(String namespace)
namespace
- the namespace to look upCopyright © 2005–2018 Apache Software Foundation. All rights reserved.