com.topologi.diffx.xml
Interface XMLFormattable

All Known Subinterfaces:
AttributeEvent, CloseElementEvent, DiffXEvent, OpenElementEvent, TextEvent
All Known Implementing Classes:
AttributeEventImpl, AttributeEventNSImpl, CharactersEvent, CharactersEventBase, CharEvent, CloseElementEventImpl, CloseElementEventNSImpl, CommentEvent, IgnorableSpaceEvent, LineEvent, OpenElementEventImpl, OpenElementEventNSImpl, ProcessingInstructionEvent, SpaceEvent, WordEvent, XMLBranchEvent

public interface XMLFormattable

An Object which implements this interface can be formatted as XML using a toXML method as a string.

This method is provided for convenience for small object to avoid the overhead in using writers.

Version:
10 December 2004
Author:
Christophe Lauret (Allette Systems)

Method Summary
 String toXML()
          Returns a xml representation of the object of the implementing class.
 StringBuffer toXML(StringBuffer xml)
          Appends the XML representation of the object of the implementing class.
 

Method Detail

toXML

StringBuffer toXML(StringBuffer xml)
                   throws NullPointerException
Appends the XML representation of the object of the implementing class.

Implementations must ensure that the returned string buffer is the same object as the specified string buffer.

Parameters:
xml - The string buffer to which the XML representation is appended to.
Returns:
The modified string buffer.
Throws:
NullPointerException - if the specified character sequence is null.

toXML

String toXML()

Returns a xml representation of the object of the implementing class.

Most implementation should use the following code to ensure consistent data with the other toXML method:

return this.toXML(new StringBuffer()).toString();

Returns:
a XML representation of the object of the implementing class.