GOMDocumentImpl<ArbitraryGOMXml> impl = new GOMDocumentImpl<ArbitraryGOMXml>();
impl.setRootElement(new ArbitraryGOMXml(new QName("test")));
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
impl.writeAtomOutput(writer);
assertEquals("<?xml version='1.0' encoding='UTF-8'?><test/>",
strWriter.toString());
}
impl.setRootElement(null);
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
impl.writeAtomOutput(writer);
assertEquals("<?xml version='1.0' encoding='UTF-8'?>", strWriter
.toString());
}
impl.setVersion("2.0");
impl.setCharacterEncoding("ISO-8859-1");
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
impl.writeAtomOutput(writer);
assertEquals("<?xml version='2.0' encoding='ISO-8859-1'?>",
strWriter.toString());
}