public class XmlEmit extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
XmlEmit.NameSpace |
static class |
XmlEmit.Notifier
Called (frequently) if set.
|
| Constructor and Description |
|---|
XmlEmit()
construct an object which will be used to collect namespace names
during the first phase and emit xml after startEmit is called.
|
XmlEmit(boolean noHeaders)
construct an object which will be used to collect namespace names
during the first phase and emit xml after startEmit is called.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNs(XmlEmit.NameSpace val,
boolean makeDefaultNs)
Called before we start to emit any tags.
|
void |
attribute(QName attr,
String attrVal)
Add an attribute
|
void |
attribute(String attrName,
String attrVal)
Add an attribute
|
void |
cdataProperty(QName tag,
String val)
Create the sequence
|
void |
cdataValue(String val)
Create the sequence
|
void |
closeTag(QName tag) |
void |
closeTagNoblanks(QName tag) |
void |
closeTagSameLine(QName tag) |
void |
emptyTag(QName tag) |
void |
emptyTag(QName tag,
String attrName,
String attrVal) |
void |
emptyTagSameLine(QName tag) |
void |
endEmptyTag()
End an empty tag
|
void |
endOpeningTag()
End a tag we are opening
|
void |
flush() |
XmlEmit.NameSpace |
getNameSpace(String ns) |
String |
getNsAbbrev(String ns) |
String |
getProperty(String name) |
Writer |
getWriter()
Return the underlying writer.
|
void |
newline()
Write a new line
|
void |
openTag(QName tag) |
void |
openTag(QName tag,
String attrName,
String attrVal)
open with attribute
|
void |
openTagNoNewline(QName tag) |
void |
openTagNoNewline(QName tag,
String attrName,
String attrVal) |
void |
openTagSameLine(QName tag) |
void |
openTagSameLine(QName tag,
String attrName,
String attrVal)
Emit an opening tag ready for nested values.
|
void |
property(QName tag,
Reader val)
Create the sequence
|
void |
property(QName tag,
String val)
Create the sequence
|
void |
propertyTagVal(QName tag,
QName tagVal)
Create the sequence
|
void |
setNotifier(XmlEmit.Notifier n)
At the moment fairly primitive - no stacking etc.
|
void |
setProperty(String name,
String val)
Allows applications to provide parameters to methods using this object class,
|
void |
startEmit(Writer wtr)
Emit any headers and namespace declarations
|
void |
startEmit(Writer wtr,
String dtd)
Emit any headers, dtd and namespace declarations
|
void |
startTag(QName tag)
Start tag ready for attributes
|
void |
startTagIndent(QName tag)
Start tag ready for attributes - new line and indent
|
void |
startTagSameLine(QName tag)
Start a tag ready for some attributes.
|
void |
value(String val)
Write out a value
|
public XmlEmit()
public XmlEmit(boolean noHeaders)
noHeaders - boolean true to suppress headerspublic void setProperty(String name, String val)
For example, a parameter "full" with value "true" might indicate a full XML dump is required.
name - val - public void startEmit(Writer wtr) throws IOException
wtr - IOExceptionpublic void startEmit(Writer wtr, String dtd) throws IOException
wtr - dtd - IOExceptionpublic void setNotifier(XmlEmit.Notifier n)
n - public void openTag(QName tag) throws IOException
tag - IOExceptionpublic void openTag(QName tag, String attrName, String attrVal) throws IOException
tag - attrName - attrVal - IOExceptionpublic void openTagNoNewline(QName tag) throws IOException
tag - IOExceptionpublic void openTagNoNewline(QName tag, String attrName, String attrVal) throws IOException
tag - attrName - attrVal - IOExceptionpublic void openTagSameLine(QName tag) throws IOException
tag - IOExceptionpublic void openTagSameLine(QName tag, String attrName, String attrVal) throws IOException
tag - attrName - attrVal - IOExceptionpublic void startTag(QName tag) throws IOException
tag - IOExceptionpublic void startTagIndent(QName tag) throws IOException
tag - IOExceptionpublic void startTagSameLine(QName tag) throws IOException
tag - IOExceptionpublic void endOpeningTag()
throws IOException
IOExceptionpublic void attribute(String attrName, String attrVal) throws IOException
attrName - attrVal - IOExceptionpublic void attribute(QName attr, String attrVal) throws IOException
attr - attrVal - IOExceptionpublic void closeTag(QName tag) throws IOException
tag - IOExceptionpublic void closeTagNoblanks(QName tag) throws IOException
tag - IOExceptionpublic void closeTagSameLine(QName tag) throws IOException
tag - IOExceptionpublic void endEmptyTag()
throws IOException
IOExceptionpublic void emptyTag(QName tag) throws IOException
tag - IOExceptionpublic void emptyTag(QName tag, String attrName, String attrVal) throws IOException
tag - attrName - attrVal - IOExceptionpublic void emptyTagSameLine(QName tag) throws IOException
tag - IOExceptionpublic void property(QName tag, String val) throws IOException
tag - val - IOExceptionpublic void cdataProperty(QName tag, String val) throws IOException
tag - val - IOExceptionpublic void property(QName tag, Reader val) throws IOException
tag - val - IOExceptionpublic void propertyTagVal(QName tag, QName tagVal) throws IOException
tag - tagVal - IOExceptionpublic void cdataValue(String val) throws IOException
val - IOExceptionpublic void value(String val) throws IOException
val - IOExceptionpublic Writer getWriter()
public void flush()
throws IOException
IOExceptionpublic void addNs(XmlEmit.NameSpace val, boolean makeDefaultNs) throws IOException
val - makeDefaultNs - - true => make this the defaultIOExceptionpublic XmlEmit.NameSpace getNameSpace(String ns)
ns - public void newline()
throws IOException
IOExceptionCopyright © 2016 Bedework. All rights reserved.