|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.topologi.diffx.format.StrictXMLFormatter
public final class StrictXMLFormatter
A simple XML formatter that writes strictly what it is given.
This formatter will write the events exactly in the order in which they are given,
in other words, there is no way to prevent this class from writing malformed XML.
On other hand, the SmartXMLFormatter
will close
XML elements automatically, therefore rectifying a lot of the errors that lead to
malformed XML.
Constructor Summary | |
---|---|
StrictXMLFormatter()
Creates a new formatter on the standard output. |
|
StrictXMLFormatter(Writer w)
Creates a new formatter using the specified writer. |
Method Summary | |
---|---|
void |
declarePrefixMapping(PrefixMapping mapping)
Adds the prefix mapping to this class. |
void |
delete(DiffXEvent e)
Formats the specified deleted event. |
void |
format(DiffXEvent e)
Formats the specified event. |
void |
insert(DiffXEvent e)
Formats the specified inserted event. |
void |
setConfig(DiffXConfig config)
Sets the configuration to use with this formatter. |
void |
setDeleteTags(String start,
String end)
Sets the open and end tags for deleted text. |
void |
setInsertTags(String start,
String end)
Sets the open and end tags for inserted text. |
void |
setWriteXMLDeclaration(boolean show)
Set whether the formatter should include the XML declaration or not. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StrictXMLFormatter()
public StrictXMLFormatter(Writer w)
w
- The writer to use.Method Detail |
---|
public void format(DiffXEvent e) throws IOException
DiffXFormatter
format
in interface DiffXFormatter
e
- The event to format
IOException
- Should an I/O exception occurs while formatting.public void insert(DiffXEvent e) throws IOException
DiffXFormatter
insert
in interface DiffXFormatter
e
- The event to format
IOException
- Should an I/O exception occurs while formatting.public void delete(DiffXEvent e) throws IOException, IllegalStateException
DiffXFormatter
delete
in interface DiffXFormatter
e
- The event to format
IOException
- Should an I/O exception occurs while formatting.
IllegalStateException
- If the formatter is not in a state to run this method.public void setInsertTags(String start, String end) throws NullPointerException
The default values are "<ins:>" and "</ins:>" respectively.
start
- The open tag for inserts.end
- The close tag for inserts.
NullPointerException
- If any of the tags is null
.public void setDeleteTags(String start, String end) throws NullPointerException
The default values are "<del:>" and "</del:>" respectively.
start
- The open tag for deletions.end
- The close tag for deletions.
NullPointerException
- If any of the tags is null
.public void setConfig(DiffXConfig config)
DiffXFormatter
setConfig
in interface DiffXFormatter
config
- The configuration to use.public void setWriteXMLDeclaration(boolean show)
XMLDiffXFormatter
setWriteXMLDeclaration
in interface XMLDiffXFormatter
show
- true
to get the formatter to write the XML declaration;
false
otherwise.public void declarePrefixMapping(PrefixMapping mapping)
declarePrefixMapping
in interface XMLDiffXFormatter
mapping
- The prefix mapping to add.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |