Hello,
I am attempting to use the November 19th build in order to test integration
between FI and Apache XMLBeans 2.1.0. The first test I tried was to serialize
an XMLBeans document through FI which results in a NullPointerException:
java.lang.NullPointerException
at com.sun.xml.fastinfoset.Encoder.encodeElementQualifiedNameOnThirdBit(Encoder.java:372)
at com.sun.xml.fastinfoset.stax.StAXDocumentSerializer.encodeTerminationAndCurrentElement(StAXDocumentSerializer.java:592)
at com.sun.xml.fastinfoset.stax.StAXDocumentSerializer.writeCharacters(StAXDocumentSerializer.java:453)
at TestFI.write(TestFI.java:128)
at TestFI.writeAll(TestFI.java:57)
at TestFI.testFI(TestFI.java:187)
at TestFI.main(TestFI.java:213)
Code in question looks like the following:
private static void testFI(XMLStreamReader in)
throws XMLStreamException
{
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
StAXDocumentSerializer sw = new StAXDocumentSerializer();
sw.setOutputStream(bytes);
XMLStreamWriter out = sw;
writeAll(in, out);
out.close();
System.out.println("FI-serialized size: " + bytes.size());
}
The XMLStreamReader is created by the XmlObject.newXMLStreamReader() and writeAll
simply iterates through the different StAX types (START_ELEMENT, etc.). If I change
from using StAXDocumentSerializer to a more conventional XMLStreamWriter, the code
works as expected. It is only when I try to serialize with FI that the exception
occurs.
I can create an archive of the example, if desired.