Interface XMLFormattable

All Known Subinterfaces:
AttributeEvent, CloseElementEvent, DiffXEvent, OpenElementEvent, TextEvent
All Known Implementing Classes:
AttributeEventImpl, AttributeEventNSImpl, CharactersEvent, CharactersEventBase, CharEvent, CloseElementEventImpl, CloseElementEventNSImpl, CommentEvent, DiffXEventBase, 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
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a xml representation of the object of the implementing class.
    Appends the XML representation of the object of the implementing class.
  • Method Details

    • toXML

      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.