Hello all, I am fairly new to jibx and I am having troubles with namespaces....
Here's my incoming XML ( I am not generating it... my code is client code) <Response Id="123" completed="2008-11-17T17:49:51.894Z" xmlns="myns"> <product productId="69738802" type="foo"/> </Response> And here's mapping.xml <?xml version="1.0" encoding="UTF-8"?> <binding> <mapping name="Response" class="ResponseImpl"> <collection field="products" type="java.util.ArrayList"> <structure type="ProductImpl"/> </collection> </mapping> <mapping name="product" class="ProductImpl"> <value style="attribute" name="productId" field="productId"/> <value style="attribute" name="type" field="type"/> </mapping> </binding> The exception I got with current mapping / xml is this one for class: Request at XmlProcessorServiceImpl.unmarshall(XmlProcessorServiceImpl.java:102) at RequestMarshallingTest.testUnmarshal(RequestMarshallingTest.java:76) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59) at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java: 98) at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(Met hodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4Clas sRunner.java:88) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunne r.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.jav a:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:2 7) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java: 42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4Tes tReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.ja va:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe stRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe stRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun ner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu nner.java:196) Caused by: org.jibx.runtime.JiBXException: No unmarshaller for element "{rsp}Response" (line 4, col 51) at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(Unmarshallin gContext.java:2770) at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(Unmarshalli ngContext.java:2930) If instead I modify the mappping like this <mapping name="Response" class="ResponseImpl"> <namespace uri="myns" default="elements"/> <collection field="products" type="java.util.ArrayList"> <structure type="ProductImpl"/> </collection> </mapping> I got following exception insead for class:Response at XmlProcessorServiceImpl.unmarshall(XmlProcessorServiceImpl.java:102) at ResponseMarshallingTest.testUnmarshal(ResponseMarshallingTest.java:76) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59) at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java: 98) at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(Met hodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4Clas sRunner.java:88) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunne r.java:51) at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.jav a:44) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:2 7) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java: 42) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4Tes tReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.ja va:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe stRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe stRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun ner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu nner.java:196) Caused by: org.jibx.runtime.JiBXException: Expected "{rsp}Response" end tag, found "{rsp}product" start tag (line 5, col 66) at org.jibx.runtime.impl.UnmarshallingContext.parsePastCurrentEndTag(Unmars hallingContext.java:800) To me, It appears that the xml that is being sent tom e is incorrect *(why would you declare a namespace that you don't' use?) But as I m fairly new to jibx, I need some help...... Thanks in advance and regards marco _______________________________________________ This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing. Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP. This email may relate to or be sent from other members of the Barclays Group. _______________________________________________ ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users