Loading...

jibx-users@lists.sourceforge.net

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [jibx-users] Hot to instruct codegen to use ordered="false? sergio Thu Mar 29 01:00:53 2012

vitomeuli <vitomeuli <at> libero.it> writes:

> 
> 
> There's one case in which my ordered="false" attribute seems to have no
> effect.
> 
> I have an XSD taken from OTA 2010B specs:
> http://old.nabble.com/file/p31789973/OTA_CommonTypes.xsd OTA_CommonTypes.xsd 
> 
> The CustomerType is indeed a <xs:sequence>, so JiBX assumes correctly it
> contains elements in the specified order.
> Unfortunately the other party server ignores it, and sends messages in the
> wrong order.
> 
> I've modified the JiBX generated mapping file:
> http://old.nabble.com/file/p31789973/org.ota.common.xml org.ota.common.xml 
> I added ordered="false", but I still get the same error:
> 
> JiBX unmarshalling exception; nested exception is
> org.jibx.runtime.JiBXException: Expected
> "{http://www.opentravel.org/OTA/2003/05}Customer" end tag, found
> "{http://www.opentravel.org/OTA/2003/05}Email" start tag (line 79, col 17) 
> 
> What can I do?
> Modify the schema setting <xs:all> in place of <xs:sequence>?
> Change position of the contained elements in the XSD?
> Why did it work in other cases, and not this time?
> 
> Any suggestion is much appreciated
> Cheers
> Vito Meuli
> 


I also faced this issue and I haven't found a solution from codegen. BUT... we 
can always run an automatic string replacement after the bindings are 
generated. 
In my case, this is the plugin I've added after jibx's plugin:

            <plugin>
              <groupId>com.google.code.maven-replacer-plugin</groupId>
              <artifactId>replacer</artifactId>
              <version>1.5.0</version>
              <executions>
                <execution>
                  <phase>prepare-package</phase>
                  <goals>
                    <goal>replace</goal>
                  </goals>
                </execution>
              </executions>
              <configuration>
                <includes>
                  <include>target/generated-sources/*binding*</include>
                </includes>
                <replacements>
                  <replacement>
                    <token><mapping</token>
                    <value><mapping ordered="false" allow-
repeats="true"</value>
                  </replacement>
                </replacements>
              </configuration>
            </plugin>


This plugin runs right after codegen. And this is working fine to me and we can 
keep binding generation as part of the build process, without any manual 
intervention.


Regards,
Sergio



------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users