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.
Modifier and Type | Method and Description |
---|---|
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.
|
StringBuffer toXML(StringBuffer xml) throws NullPointerException
Implementations must ensure that the returned string buffer is the same object as the specified string buffer.
xml
- The string buffer to which the XML representation is appended to.NullPointerException
- if the specified character sequence is null
.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();
Copyright © 2007-2019. All Rights Reserved.