Hi Dennis,
Sorry I didn't attach that. Here it is.
<mapping class="com.columboid.protocol.syncml.representation.VerDTD"
name="VerDTD">
<value style="element" name="VerDTD" get-method="getVerDTD"
set-method="setVerDTD"/>
</mapping>
And actually, this mapping was generated by CodeGen with default settings
from an XSD.
Thanks for looking into this problem. :)
Peter
-----Original Message-----
From: Dennis Sosnoski [mailto:[email protected]]
Sent: Friday, October 09, 2009 5:26 PM
To: JiBX users
Subject: Re: [jibx-users] jibx can't find the right tag
Hi Peter,
You don't show the <mapping> definition for the VerDTD element. From the
message you're getting, I wonder if this <mapping> might be referencing
itself.
Out of curiosity, do you really need each of the elements to be
represented by a separate class? It looks like most of these just
contain simple values, which can be represented by primitives or String
fields using a <value> component in the binding. That would give you
this type of <mapping> for <SyncHdr>:
<mapping ...>
<value name="VerDTD" get-method="getVerDTD" set-method="setVerDTD"/>
<value name="VerProto" get-method="getVerProto" set-method="setVerProto"/>
...
With a class like:
public class SyncHdr
{
private String verDTD;
private String verProto;
...
- Dennis
Dennis M. Sosnoski
XML and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117
Peter Wu wrote:
>
> Greetings,
>
> I'm using v1.2.1 to unmarshal an xml to its java object and I always
> get the following error.
>
> Expected "{http://example.com}VerDTD" start tag, found
> "{http://example.com}VerDTD" end tag (line 1, col 152)
>
> Actually, at line 1, col 152, is </VerDTD>.
>
> So, jibx finds the </VerDTD> tag correctly but, for some reason,
> thinks it should be <VerDTD> rather than </VerDTD>.
>
> A segment of the binding.xml wrt the VerDTD tag is in red below.
>
> <mapping class="com.example.SyncHdr" name="SyncHdr">
>
> <structure type="com.example.VerDTD" get-method="getVerDTD"
> set-method="setVerDTD"/>
>
> <structure type="com.example.VerProto" get-method="getVerProto"
> set-method="setVerProto"/>
>
> <structure type="com.example.SessionID" get-method="getSessionID"
> set-method="setSessionID"/>
>
> <structure type="com.example.MsgID" get-method="getMsgID"
> set-method="setMsgID"/>
>
> <structure type="com.example.Target" get-method="getTarget"
> set-method="setTarget"/>
>
> <structure type="com.example.Source" get-method="getSource"
> set-method="setSource"/>
>
> <structure type="com.example.RespURI" get-method="getRespURI"
> set-method="setRespURI" usage="optional"/>
>
> <structure type="com.example.NoResp" get-method="getNoResp"
> set-method="setNoResp" usage="optional"/>
>
> <structure type="com.example.Cred" get-method="getCred"
> set-method="setCred" usage="optional"/>
>
> <structure type="com.example.Meta" get-method="getMeta"
> set-method="setMeta" usage="optional"/>
>
> </mapping>
>
> A segment of xml for this binding is:
>
> <SyncHdr>
>
> <VerDTD>1.1</VerDTD>
>
> <VerProto>SyncML/1.1</VerProto>
>
> <SessionID>1</SessionID>
>
> <MsgID>1</MsgID>
>
> <Target>
>
> <LocURI>/</LocURI>
>
> </Target>
>
> <Source>
>
> <LocURI>GSM Remote ML</LocURI>
>
> </Source>
>
> </SyncHdr>
>
> The Java class, SyncHdr looks good to me, too.
>
> *public* *class* SyncHdr
>
> {
>
> *private* VerDTD verDTD;
>
> *private* VerProto verProto;
>
> *private* SessionID sessionID;
>
> *private* MsgID msgID;
>
> *private* Target target;
>
> *private* Source source;
>
> *private* RespURI respURI;
>
> *private* NoResp noResp;
>
> *private* Cred cred;
>
> *private* Meta meta;
>
> /**
>
> * getters and setters
>
> */
>
> }
>
> I'm still new to jibx and have been fighting with this problem for 2
> days after googling around for a resolution. Please help!! Thanks!
>
> Cheers,
>
> Peter
>
> ------------------------------------------------------------------------
>
>
----------------------------------------------------------------------------
--
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> ------------------------------------------------------------------------
>
> _______________________________________________
> jibx-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users