}
public SerializationHandler getSerializationHandler()
throws IOException, ParserConfigurationException
{
SerializationHandler result = null;
switch (_outputType)
{
case STREAM :
if (_method == null)
{
result = new ToUnknownStream();
}
else if (_method.equalsIgnoreCase("xml"))
{
result = new ToXMLStream();
}
else if (_method.equalsIgnoreCase("html"))
{
result = new ToHTMLStream();
}
else if (_method.equalsIgnoreCase("text"))
{
result = new ToTextStream();
}
if (result != null && _indentNumber >= 0)
{
result.setIndentAmount(_indentNumber);
}
result.setEncoding(_encoding);
if (_writer != null)
{
result.setWriter(_writer);
}
else
{
result.setOutputStream(_ostream);
}
return result;
case DOM :
_handler = (_node != null) ? new SAX2DOM(_node, _nextSibling, _useServicesMechanism) : new SAX2DOM(_useServicesMechanism);