[
http://jira.codehaus.org/browse/JIBX-188?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dennis Sosnoski resolved JIBX-188.
----------------------------------
Assignee: Dennis Sosnoski
Resolution: Won't Fix
The use of flexible="true" means that JiBX needs to be able to identify exactly
which elements are an expected part of the binding and which are not (and
should therefore be discarded). The binding validation check which you've
encountered was added in order to avoid problems which could occur if
components did not have names, which in your case occurs with the references to
the abstract mapping for com.foo.bar.Product.
Judging from your binding, you'd like to be able to handle the elements defined
in the base class, along with those added by the subclasses, in any order, and
to ignore any other elements. That's more involved than I'm willing to support
with the current codebase. I'll see if I can implement this type of handling
for JiBX 2.0.
> Binding Compiler: Upgrade to 1.1.5 from 1.1.3 forces name attribute on nested
> structures using map-as
> -----------------------------------------------------------------------------------------------------
>
> Key: JIBX-188
> URL: http://jira.codehaus.org/browse/JIBX-188
> Project: JiBX
> Issue Type: Bug
> Components: core
> Affects Versions: JiBX 1.1.5
> Environment: Windows
> JDK 1.6
> Ant 1.7
> Reporter: Ezra Epstein
> Assignee: Dennis Sosnoski
>
> A binding with:
> <?xml version="1.0" encoding="UTF-8"?>
> <binding forwards="false">
> <mapping class="com.foo.bar.ProductProxy" name="ProductProxy"
> ordered="false" flexible="true">
> <value name="catalogId" field="catalogId" />
> <value name="catalogProductId" field="catalogProductId" />
> <structure map-as="com.foo.bar.Product" />
> </mapping>
> <mapping class="com.foo.bar.UserProduct" name="UserProduct"
> ordered="false" flexible="true">
> <structure map-as="com.foo.bar.Product" />
> </mapping>
> <mapping abstract="true" class="com.foo.bar.Product" ordered="false">
> <value name="id" field="id" usage="optional" /><!-- Not
> provided on POST, hence optional -->
> <value name="version" field="version" usage="optional" />
> <value name="deleted" field="deleted" usage="optional"
> default="false" />
> <value name="name" field="name" />
> <value name="description" field="description" usage="optional"
> />
> <value name="price" field="price" usage="optional" />
> <value name="detailUrl" field="detailUrl" usage="optional" />
> <structure name="imageUrl" value-style="attribute">
> <value name="href" field="imageUrl" usage="optional" />
> </structure>
> </mapping>
> <mapping class="amazon.a3n.rest.ResultsList" name="results">
> <collection field="results" create-type="java.util.ArrayList" />
> </mapping>
> </binding>
> Worked fine with 1.1.3 but throws exception during compilation. I am mapping
> an abstract superclass and do not want to have an element for that superclass
> in the xml.
> [jibx-bind] Error: All child components must define element names for
> flexible='true'; on structure element at (line 6, col
> 50, in Product.binding.xml)
> [jibx-bind] Error: All child components must define element names for
> flexible='true'; on structure element at (line 9, col
> 50, in Product.binding.xml)
> [jibx-bind] Error running binding compiler
> [jibx-bind] org.jibx.runtime.JiBXException: Binding Product.binding.xml is
> unusable because of validation errors
> [jibx-bind] at org.jibx.binding.Utility.loadBinding(Utility.java:346)
> [jibx-bind] at org.jibx.binding.Utility.loadFileBinding(Utility.java:413)
> [jibx-bind] at org.jibx.binding.Compile.compile(Compile.java:296)
> [jibx-bind] at
> org.jibx.binding.ant.CompileTask.execute(CompileTask.java:248)
> [jibx-bind] at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> [jibx-bind] at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
> [jibx-bind] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> [jibx-bind] at java.lang.reflect.Method.invoke(Method.java:597)
> [jibx-bind] at
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> [jibx-bind] at org.apache.tools.ant.Task.perform(Task.java:348)
> [jibx-bind] at org.apache.tools.ant.Target.execute(Target.java:357)
> [jibx-bind] at org.apache.tools.ant.Target.performTasks(Target.java:385)
> [jibx-bind] at
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> [jibx-bind] at
> org.apache.tools.ant.Project.executeTarget(Project.java:1298)
> [jibx-bind] at
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> [jibx-bind] at
> org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> [jibx-bind] at org.apache.tools.ant.Main.runBuild(Main.java:698)
> [jibx-bind] at org.apache.tools.ant.Main.startAnt(Main.java:199)
> [jibx-bind] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
> [jibx-bind] at
> org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
> [jibx-bind]
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs