I've been looking into the AnyComplexTypeUnitTestCase. One issue related to the test
was fixed in JBossXB. The other one is the way the binding is configured in the test
itself.
Specifically, it's the use of type.setStartElementCreatesObject(false). It's
always true for the complex types or types that are supposed to have child values.
Following that, in the testcase it should be true (i.e. not set to false). I'll add a
javadoc description to clarify that.
This is the diff with an example of a correct binding to make the test pass:
$ svn diff test/
| Index: test/java/org/jboss/test/xml/AnyComplexTypeUnitTestCase.java
| ===================================================================
| --- test/java/org/jboss/test/xml/AnyComplexTypeUnitTestCase.java (revision
2184)
| +++ test/java/org/jboss/test/xml/AnyComplexTypeUnitTestCase.java (working
copy)
| @@ -34,6 +34,7 @@
| import org.jboss.xb.binding.metadata.ValueMetaData;
| import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler;
| import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor;
| +import org.jboss.xb.binding.sunday.unmarshalling.DefaultHandlers;
| import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
| import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
| import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler;
| @@ -155,15 +156,24 @@
|
| DOMUnresolvedHandler unresolved = new DOMUnresolvedHandler();
| TypeBinding type = schema.getType(new QName(NS, "any-complexType"));
| - type.setStartElementCreatesObject(false);
| + //type.setStartElementCreatesObject(false);
| + type.setHandler(new DOMUnresolvedHandler()
| + {
| + public void setParent(Object parent, Object o, QName qName, ParticleBinding
particle,
| + ParticleBinding parentParticle)
| + {
| + DefaultHandlers.ELEMENT_HANDLER.setParent(parent, o, qName, particle,
parentParticle);
| + }
| + }
| + );
| WildcardBinding wild = type.getWildcard();
| assertNotNull(wild);
| wild.setUnresolvedElementHandler(unresolved);
| wild.setUnresolvedCharactersHandler(unresolved);
|
| - DOMInterceptor interceptor = new DOMInterceptor();
| - element = schema.getElement(new QName(NS, "element"));
| - element.pushInterceptor(interceptor);
| + //DOMInterceptor interceptor = new DOMInterceptor();
| + //element = schema.getElement(new QName(NS, "element"));
| + //element.pushInterceptor(interceptor);
|
| Top top = (Top)
unmarshal("AnyComplexTypeFromMultipleWildCardAndElement.xml", schema,
Top.class);
| Element dom = top.element;
|
The snapshot in the repository hasn't been updated yet.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991235#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...