This issue is a copy and slight restatement of
AXIS2-1129, copied here because it apparently is an XMLBeans problem which has little to do with AXIS2 per se. Please consult AXIS2-1129 to see some of the analysis history and discussion of this bug, as well as a proposed workaround.
The essence of this bug is that the following code (consisting of a generated Foo type parsed from an XML schema, and a generated FooDocument type which represents an XML document whose top-level element is a Foo instance):
Foo foo = Foo.Factory.parse("<foo>Stuff</foo>")
FooDocument fooDocument = FooDocument.Factory.newInstance();
that the output of this is similar to this:
when it should be this:
Also note that the workaround proposed in
AXIS2-1129 by Dims seems to involve having to modify the XML schema to use qualified references to access various parts of itself, in ways that should be totally invisible to any standards-abiding XML schema parser. (It should make no difference if the schema uses qualified references or not if the meaning is unchanged) which might possibly indicate another bug.