Thanks for the help.

It even gets stranger...
I'm using binding as explained in
http://jibx.sourceforge.net/tutorial/binding-structures.html (Figure 5.
Flattened binding).
It's working for the first time... but it fails for the second object.
Don't even ask... Murphy Law?

org.jibx.runtime.JiBXException: Unable to create unmarshaller of class
mypackage.JiBX_bindingResponse_access:
java.lang.ClassCastException
        at
        org.jibx.runtime.impl.UnmarshallingContext.getUnmarshaller(Unknown
        Source)
        at
        org.jibx.runtime.impl.UnmarshallingContext.getUnmarshaller(Unknown
        Source)
        at
        org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(Unknown
        Source)
        at
        org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(Unknown
        Source)

I was using maven plugin 1.1 with dependencies to jibs 1.0-RC1. Updated
to 1.1 (changed the dependency version in the plugin pom.xml). Added
xpp3 dependency and worked as expected! _:)
         <dependency>
            <groupId>xpp3</groupId>
            <artifactId>xpp3</artifactId>
            <version>1.1.3.3</version>
        </dependency>

On Thu, 23 Nov 2006 14:12:01 +0100, "Tilman Linden"
<[EMAIL PROTECTED]> said:
> The problem must be something else. Please take a look at the
> structure-binding tutorial at
> 
> http://jibx.sourceforge.net/tutorial/binding-structures.html#intro
> 
> A quote:
> 
> "[...] the structure of your objects is not tied to the structure of the
> XML - you can restructure your object classes without needing to change
> the XML format [...]"
> 
> In fact the original binding provided by Joel seems correct to me.
> Leaving out the "field" attribute of a "structure" element does exactly
> what is desired: It defines an element existent in XML for which no
> corresponding field does exist in the Java code.
> 
> Joel, could you provide some more details on the error you encounter
> (stack trace...)?
> 
> Best regards,
> 
> Tilman
> 
> 
> 
> Stephane Elie wrote:
> > My guess is that the default (un)marshaller doesn't support this.
> > You can do what you want by creating a custom (un)marshaller.
> > http://jibx.sourceforge.net/tutorial/binding-custom.html
> > <http://jibx.sourceforge.net/tutorial/binding-custom.html>
> >
> >
> > On 11/23/06, [EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>* <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> >     Yes. The problem is that I can't change the source xml and I would
> >     like
> >     to keep also the same Java. Is there anything that I can change in the
> >     binding.xml? Can I use "a" for root mapping instead of "p"?
> >
> >     Thanks.
> >
> >     On Wed, 22 Nov 2006 22:51:31 -0500, "Stephane Elie"
> >     <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> said:
> >     > Hi Joel,
> >     >
> >     > You have a mismatch between XML vs mapping vs Java, if I assume
> >     that the
> >     > Java is OK (because the XML is invalid), here are the
> >     appropriate XML and
> >     > mapping for it:
> >     > This is untested so it may contain mistakes, let me know if this
> >     is the
> >     > case.
> >     >
> >     > The source xml:
> >     > <p>
> >     >     <c>0</c>
> >     >     <d>Success</d>
> >     > </p>
> >     >
> >     > The binding file:
> >     > <binding>
> >     >     <mapping class="Response" name="p">
> >     >          <value name="c" field="code" />
> >     >          <value name="d" field="desc" />
> >     >     </mapping>
> >     > </binding>
> >     >
> >     > Stephane
> >     >
> >     > On 11/22/06, [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]> <[EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>> wrote:
> >     > >
> >     > > Hi All,
> >     > >
> >     > > This is what I have.
> >     > >
> >     > > The source xml:
> >     > > <p>
> >     > >     <a>
> >     > >         <c>0</code>
> >     > >         <d>Success</desc>
> >     > >     </a>
> >     > > </p>
> >     > >
> >     > > The binding file:
> >     > > <binding>
> >     > >     <mapping class="Response" name="p">
> >     > >      <structure name="a">
> >     > >          <value name="c" field="code" />
> >     > >          <value name="d" field="desc" />
> >     > >      </structure>
> >     > >     </mapping>
> >     > > </binding>
> >     > >
> >     > > The java class and call code:
> >     > > public class Response {
> >     > >     private int code = 10;
> >     > >     private String desc = "Internal error";
> >     > > }
> >     > >
> >     > > final IBindingFactory bFact =
> >     > > BindingDirectory.getFactory(responseClass);
> >     > > final IUnmarshallingContext context =
> >     > > bFact.createUnmarshallingContext();
> >     > > response = (IResponse)
> >     > > context.unmarshalDocument(method.getResponseBodyAsStream (),
> >     null);
> >     > >
> >     > > The mapping is not working because it tries to create an
> >     Response with
> >     > > an InnerClass "a" but it crashes because the Response Object
> >     doesn't
> >     > > have any "a" property.
> >     > >
> >     > > Any help/idea? TIA,
> >     > >
> >     > >      Joel
> >     > >
> >     > > --
> >     > > --
> >     > >
> >     > >   [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> >     > >
> >     > > --
> >     > > http://www.fastmail.fm - Or how I learned to stop worrying and
> >     > >                           love email again
> >     > >
> >     > >
> >     > >
> >     
> > -------------------------------------------------------------------------
> >     > > Take Surveys. Earn Cash. Influence the Future of IT
> >     > > Join SourceForge.net's Techsay panel and you'll get the chance
> >     to share
> >     > > your
> >     > > opinions on IT & business topics through brief surveys - and
> >     earn cash
> >     > >
> >     
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >     
> > <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
> >     > > _______________________________________________
> >     > > jibx-users mailing list
> >     > > [email protected]
> >     <mailto:[email protected]>
> >     > > https://lists.sourceforge.net/lists/listinfo/jibx-users
> >     > >
> >     --
> >
> >       [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> >
> >     --
> >     http://www.fastmail.fm <http://www.fastmail.fm> - I mean, what is
> >     it about a decent email service?
> >
> >
> >     
> > -------------------------------------------------------------------------
> >     Take Surveys. Earn Cash. Influence the Future of IT
> >     Join SourceForge.net's Techsay panel and you'll get the chance to
> >     share your
> >     opinions on IT & business topics through brief surveys - and earn cash
> >     
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >     
> > <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
> >     _______________________________________________
> >     jibx-users mailing list
> >     [email protected]
> >     <mailto:[email protected]>
> >     https://lists.sourceforge.net/lists/listinfo/jibx-users
> >
> >
> > ------------------------------------------------------------------------
> >
> > -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share your
> > opinions on IT & business topics through brief surveys - and earn cash
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > jibx-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/jibx-users
> >   
> 
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> jibx-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
-- 
  
  [EMAIL PROTECTED]

-- 
http://www.fastmail.fm - The way an email service should be


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to