It may be worth noting that if I take out the
"element.declareNamespace(factory.createOMNamespace("http://whocares",
"wc"));" call in the sample program and implement the serialize methods in
the TestDataSource, it works fine. So, I'm starting to suspect that there
is some kind of disconnect with sourced OMElement objects if you try to
manipulate them programmatically, but I can't quite figure out why.
_____
From: Ryan Nelsestuen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 20, 2007 1:30 PM
To: [email protected]
Subject: XMLStreamException on serialize
We're running into an exception when we try to serialize and consume our
OMElements to an outputstream. It looks like the cache flag on the
children's builder is getting set to false by the parent in the
OMElementImpl. internalSerialize(XMLStreamWriter writer, boolean cache)
which means that the underlying parser gets next() called repeatedly without
the done flag ever getting set until the underlying parser throws an
exception since it goes past the end.
This is Axiom version 1.2.2
I've attached a zip file with some simple code that reproduces the problem.
see the readme.txt for details and a stack trace. If anyone can shed any
light on how to avoid this exception, I would appreciate it. I've tried
updating the StAXOMBuilder.next() method to check the return value from the
parser (and set done when appropriate) but that seems to either result in
the child element not being included (if I also flag "done" on the
associated node) or hitting the exception at the top of the next() method
(if I don't).
Ryan Nelsestuen