Hi Peter,

Your XML document doesn't match your schema. If you want to allow 
arbitrary content inside the <Meta> element (including nested elements) 
you can't type it as xs:string.

If you don't give a type for the element (i.e., just have <element 
name="Meta"/>) the definition will be correct in schema terms. CodeGen 
*should* use a DOM element representation for the element in this case, 
which would preserve the XML structure of the content.

  - 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:
> Hi Dennis,
>
> I tried the 1.2.2-SNAPSHOT and it fixed the original problem I 
> reported. Thanks.
>
> However, I found a new issue. Please consider the following xsd.
>
>
>   <!-- The Meta content would be something such as: <Meta> <Type 
> xmlns='syncml:metinf'>text/calendar</Type> <Format 
> xmlns='syncml:metinf'>xml</Format> </Meta> -->
>   <xs:element name="Meta" type="xs:string"/>
>
>
> The Meta tag accepts xs:string. However, the xs:string it's going to 
> accept is actually a string of xml tags. This seems to confuse jibx as 
> it is expecting a non-xml string. Here is an example:
>
> <Meta>
>      <MaxMsgSize xmlns='syncml:metinf'>2700</MaxMsgSize>
> </Meta>
>
>
> When jibx looks at this xml content, it will throw an exception 
> complaining about missing </Meta> tag as it detects <MaxMsgSize> right 
> after <Meta>. Is there a way to work around this problem? Thanks!
>
>
>
> Thanks,
> Peter Wu
>
>
>
> > Date: Sat, 10 Oct 2009 12:07:03 +1300
> > From: d...@sosnoski.com
> > To: jibx-users@lists.sourceforge.net
> > Subject: Re: [jibx-users] jibx can't find the right tag
> >
> > Peter Wu wrote:
> > > ...
> > >
> > > <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.
> > >
> >
> > Ah, that would explain it then. :-)
> >
> > The generated <mapping> is wrong, due to a bug in CodeGen which I
> > actually fixed yesterday (http://jira.codehaus.org/browse/JIBX-309). 
> The
> > bug is actually much more serious than the initial statement suggested,
> > applying to any global element definition using a simple type 
> reference.
> > It looks like the SyncML schema must use this type of definition.
> >
> > So here's three possible solutions:
> >
> > 1. Download the latest jibx-*-1.2.2SNAPSHOT jars from the Maven
> > repository at http://www.jibx.org/maven/jibx/jars and use those.
> > 2. Wait another 2-3 days and I'll post a pre-release trial build for
> > 1.2.2, which I'm planning to do because there are so many changes
> > from 1.2.1 (I'll email this list when I post it, and will have it
> > up for about a week before the official 1.2.2 release)
> > 3. Use 1.2.1, but customize the code generation - what you'd want to
> > do is use generate-all="false" and prefer-inline="true", then
> > specify the specific top-level elements you want to generate with
> > includes="SyncHdr name2 name3 ..." (see
> > http://jibx.sourceforge.net/fromschema/codegen-customs.html for
> > some discussion of customizations, or
> > http://www.ibm.com/developerworks/java/tutorials/j-jibx2/)
> >
> > 3 is more effort, but is probably what you're going to want to do in 
> the
> > long run because it's going to be painful to work with a separate class
> > for every single value in the XML document structure.
> >
> > - Dennis
> >
> > 
> ------------------------------------------------------------------------------
> > 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
> > jibx-users@lists.sourceforge.net
> > 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
> jibx-users@lists.sourceforge.net
> 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
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to