com.topologi.diffx.xml.XMLFormattable Maven / Gradle / Ivy
Show all versions of docx4j-diffx Show documentation
/*
* This file is part of the DiffX library.
*
* For licensing information please see the file license.txt included in the release.
* A copy of this licence can also be found at
* http://www.opensource.org/licenses/artistic-license-2.0.php
*/
package com.topologi.diffx.xml;
/**
* 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.
*
* @author Christophe Lauret (Allette Systems)
*
* @version 10 December 2004
*/
public interface XMLFormattable {
/**
* 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.
*
* @param xml The string buffer to which the XML representation is appended to.
*
* @return The modified string buffer.
*
* @throws NullPointerException if the specified character sequence is null
.
*/
StringBuffer toXML(StringBuffer xml) throws NullPointerException;
/**
*
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();
*
* @return a XML representation of the object of the implementing class.
*/
String toXML();
}