logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: complex list within nested repeat fails: msg#00000

Subject: Re: complex list within nested repeat fails
hello dean,

finally i found time to have a close look at your example and to track down what's going wrong. the cause of your trouble is in Chiba's Insert action in conjunction with the Instance class. it doesn't find the right prototypical instance for some nested repeat, and so it inserts a wrong nodeset which causes ui errors.

the reason for this is the kind of binding-expressions you are using a lot in your form (nodesets with predicates). during the lookup of the prototypical instance member xpathes constructed from binding expressions are canonicalized, i.e.

/prsdata/formdata/group[@name='ProductSpecGroup']/record[2]/group[@name='IngredientGroup']/record[2]/field[@name='REGN_ING']/value

becomes something like

/prsdata[1]/formdata[1]/group[7]/record[2]/group[2]/record[2]/field[2]/value[1]

and thus the predicate information constraining the nodeset is lost. this is surely an error, but after having a glance on it i don't think it could be fixed easily. the whole process of looking up the protoypical member is much too complicated (thanks to the spec). i wrote 24 test-cases only for Instance.insertNode, but this seems not to be sufficient ;-)

however, there's workaround. if you replace your predicated 'group' and 'field' elements with specifically named elements (e.g. group[@name='IngredientGroup'] -> ingredientGroup) , all should be fine, but i don't know if your use case allows for this.

so i'd like to ask you to strip down your example a bit (removing all the stuff which doesn't belong to the errornous repeats) and post it to the list or to sf.net as a bug. if you want to investigate this bug further, point your debugger to Instance.insertNode. of course any contributions are welcome.

hope this helps.

regards,
uli.

ps: an improved itemset implementation including copy support is planned for the 0.9.9 release, which is scheduled for end of this year.

pps: hope you don't mind putting this back to the list.

Dean Giesbrecht wrote:
Hello Uli,

I has been awhile and the mailing list has been silent on this problem so I
was wondering what your thoughts were on it. (I'm asking you because due to
the size of the sample code, you're the only one I've sent to code to.)
Does it look like a problem in my code or should I really submit it as a
bug?  Any suggestions on where to start investigating?

Thanks in advance,
Dean

-----Original Message-----
From: Dean Giesbrecht [mailto:d.giesbrecht-eNVTVdx+BL0@xxxxxxxxxxxxxxxx]
Sent: Wednesday, October 27, 2004 3:35 PM
To: Ulrich Nicolas Lissé
Subject: RE: [Chiba-developer] complex list within nested repeat fails

Uli,

Originally I provided only a snippet of the code because the actual code for
the form is huge.  I have now attached it but didn't post it to the group
for this reason.
The problem seems to occur only when adding a repeat.  If the second repeat
B is already in the second repeat A in the instance data when the form is
loaded then there is not a problem.

BTW, which release and when are you folks targeting the release containing
the improved itemset functionality?

Thanks for your help,
Dean


-----Original Message-----
From: Ulrich Nicolas Lissé [mailto:u.n.l-hi6Y0CQ0nG0@xxxxxxxxxxxxxxxx]
Sent: Tuesday, October 26, 2004 9:58 AM
To: Dean Giesbrecht
Cc: chiba-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
Subject: Re: [Chiba-developer] complex list within nested repeat fails

hello dean,

please provide a complete form exposing the malfunction. this makes it
easier for us to track things down. moreover, you could file a bug
report on sourceforge.

however, you report that all works fine when you use an input instead of
an itemset. the current itemset implementation is definitely incomplete,
so this might be an indication for another itemset bug. we have itemset
on our todo list for 1.0.

regards, uli.

Dean Giesbrecht wrote:

Hello,



The following is the repeat structure on my form:



   Repeat A

     |-----Repeat B

     |            |-----Repeat C

     |-----Repeat D



When I insert any element within repeat A, B, C or D using the initial
instance data containing only 1 repeat of each, I have no problems.

Within the second( or greater) Repeat A, the nested repeats still work
EXCEPT for Repeat B.  I get



 JXPathException: No value for xpath:


/prsdata/formdata/group[@name='ProductSpecGroup']/record[2]/group[@name='Ing
redientGroup']/record[2]/field[@name='REGN_ING']/value



(Repeat B is the "IngredientGroup" and "REGN_ING" is a complex list)
What it is failing on is a complex list using select1.  If I switch it
to an input, the problem goes away.  To baffle me even more, if I start
with instance data in the model that already has a second Repeat B
within the second Repeat A, when I insert a third Repeat B there is no
problem.



This problem existed in both Chiba 0.9.5 and 0.9.7.

Below is the relevant code for Repeat B.  I have also included the full
stack trace at the end.



Any thoughts on this problem would be greatly appreciated.  It would be
a shame to not put this application into production because of this one
problem!

Thanks,

Dean



---- Code snippet ----



<xforms:model id="esubmission-model">

<xforms:instance id="esubmission-instance">



<prsdata>

<formdata formtype="ESUB">

    <group name="ProductSpecGroup">

         <record name="ProductSpec">

              <group name="IngredientGroup">

                   <record name="Ingredient">

                        <field name="REGN_ING">

                        ...

                             <value>unit1</value>

                        </field>

                        ...

                        <group name="SupplierGroup">

                             <record name="Supplier">

                                  <field name="NAME"><value>Supplier
Name 1</value></field>

                                  ....

                             </record>

                        </group>

                   </record>

              </group>

         </record>

    </group>

</formdata>

    <listdata>

         <ingr-regn>

              <entry id="9082.0">9082 - NAME1</entry>

              <entry id="7036.0">7036 - NAME2</entry>

              <entry id="8287.0">8287 - NAME3</entry>

              <entry id="11019.0">11019 - NAME4</entry>

              <entry id="12171.0">12171 - NAME5</entry>

              <entry id="10848.0">10848 - NAME6</entry>

              <entry id="11251.0">11251 - NOT AVAILABLE</entry>

              ...

         </ingr-regn>

           ....

    </listdata>

</prsdata>

</xforms:instance>

</xforms:model>



...



<xforms:bind id="bind-lists" xforms:nodeset="/prsdata/listdata">

    <xforms:bind id="bind-ING-REGN_ING-entry"
xforms:nodeset="ingr-regn/entry">

         <xforms:bind id="bind-ING-REGN_ING-label" xforms:nodeset="."/>

         <xforms:bind id="bind-ING-REGN_ING-value" xforms:nodeset="@id"/>

    </xforms:bind>

    ...

</xforms:bind>



...

<xforms:bind id="bind-product-specs"
xforms:nodeset="/prsdata/formdata/group[@name='ProductSpecGroup']/record">

...

    <xforms:bind id="bind-ingredient-info"
xforms:nodeset="group[@name='IngredientGroup']/record">

         <xforms:bind id="bind-ING-REGN_ING"
xforms:nodeset="field[@name='REGN_ING']/value"/>





...



<xforms:group id="group-ingredient-information" appearance="minimal">

    <br/>

    <xforms:label>

    <EN>Ingredient Information</EN>

    <FR>Renseignements sur les matières</FR>

    </xforms:label>

    <br/>

    <xforms:trigger chiba:onClick="EncryptFields(this.name);return

false;">

              <xforms:label>

                  <EN>Add Ingredient</EN>

              </xforms:label>

              <xforms:action>

                   <xforms:insert at="index('repeat-ingredient-info')"
bind="bind-ingredient-info" position="after"/>

              </xforms:action>

    </xforms:trigger>

    <xforms:trigger chiba:onClick="EncryptFields(this.name);return

false;">

              <xforms:label>

                  <EN>Delete Selected Ingredient</EN>

              </xforms:label>

              <xforms:action>

                   <xforms:delete at="index('repeat-ingredient-info')"
bind="bind-ingredient-info"/>

              </xforms:action>

    </xforms:trigger>



   <xforms:repeat chiba:index="1" id="repeat-ingredient-info"
bind="bind-ingredient-info" appearance="full">

...



    <xforms:select1 id="REGN_ING" xforms:bind="bind-ING-REGN_ING"
chiba:class="regn-ing">

         <xforms:label>

              <EN>Registration #</EN>

              <FR>No d'homologation</FR>

         </xforms:label>

         <xforms:itemset id="REGN_ING-itemset"
bind="bind-ING-REGN_ING-entry">

              <xforms:label bind="bind-ING-REGN_ING-label"/>

              <xforms:value bind="bind-ING-REGN_ING-value"/>

         </xforms:itemset>

         <xforms:alert>Please make selection from list</xforms:alert>

    </xforms:select1>

...







--- Full Stack Trace -----

org.apache.commons.jxpath.JXPathException: No value for xpath:


/prsdata/formdata/group[@name='ProductSpecGroup']/record[2]/group[@name='Ing
redientGroup']/

record[2]/field[@name='REGN_ING']/value

       at


org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathConte
xtReferenceImpl.java:314)

       at


org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathConte
xtReferenceImpl.java:289)

       at


ca.gc.pmra.prs.xforms.chiba.xml.xforms.ui.BoundElementSource.getInstanceValu
e(BoundElementSource.java:294)

       at


org.chiba.xml.xforms.ui.AbstractFormControl.getValue(AbstractFormControl.jav
a:161)

       at org.chiba.xml.xforms.ui.Itemset.expand(Itemset.java:262)

       at
org.chiba.xml.xforms.ui.Itemset.initializeItemset(Itemset.java:223)

       at org.chiba.xml.xforms.ui.Itemset.init(Itemset.java:155)

       at


org.chiba.xml.xforms.Initializer.initializeUIElements(Initializer.java:276)

       at


org.chiba.xml.xforms.ui.AbstractUIElement.initializeChildren(AbstractUIEleme
nt.java:216)

       at org.chiba.xml.xforms.ui.Select1.init(Select1.java:164)

       at


org.chiba.xml.xforms.Initializer.initializeUIElements(Initializer.java:276)

       at org.chiba.xml.xforms.ui.RepeatItem.init(RepeatItem.java:276)

       at

org.chiba.xml.xforms.ui.Repeat.createRepeatItem(Repeat.java:505)

       at

org.chiba.xml.xforms.ui.Repeat.insertRepeatItem(Repeat.java:520)

       at org.chiba.xml.xforms.ui.Repeat.handleEvent(Repeat.java:178)

       at org.apache.xerces.dom.DocumentImpl.dispatchEvent(Unknown

Source)

       at
org.chiba.xml.xforms.XFormsDocument.dispatchEvent(XFormsDocument.java:133)

       at org.apache.xerces.dom.NodeImpl.dispatchEvent(Unknown Source)

       at org.chiba.xml.xforms.Container.dispatch(Container.java:470)

       at org.chiba.xml.xforms.Instance.insertNode(Instance.java:488)

       at
org.chiba.xml.xforms.action.InsertAction.perform(InsertAction.java:208)

       at


..sniped...chiba.xml.xforms.action.ActionActionPrsCode.perform(ActionActionP
rsCode.java:174)

       at


org.chiba.xml.xforms.action.AbstractAction.handleEvent(AbstractAction.java:1
82)

       at org.apache.xerces.dom.DocumentImpl.dispatchEvent(Unknown

Source)

       at
org.chiba.xml.xforms.XFormsDocument.dispatchEvent(XFormsDocument.java:133)

       at org.apache.xerces.dom.NodeImpl.dispatchEvent(Unknown Source)

       at org.chiba.xml.xforms.Container.dispatch(Container.java:470)

       at org.chiba.xml.xforms.Container.dispatch(Container.java:442)

       at org.chiba.xml.xforms.Container.dispatch(Container.java:423)

       at org.chiba.xml.xforms.ChibaBean.dispatch(ChibaBean.java:500)

       at


..sniped...chiba.adapter.web.HttpRequestHandlerPrsCode.handleRequest(HttpReq
uestHandlerPrsCode.java:101)

       at


..sniped...chiba.adapter.web.HttpRequestHandlerSource.execute(HttpRequestHan
dlerSource.java:166)

       at


..sniped...chiba.adapter.web.ServletAdapterSource.executeHandler(ServletAdap
terSource.java:252)

       at


..sniped...chiba.adapter.web.ChibaServletPrsCode.doPost(ChibaServletPrsCode.
java:319)

       at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

       at


org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:237)

       at


org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:157)

       at


org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:214)

       at


org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)

       at


org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

       at


org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
Valve.java:198)

       at


org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:152)

       at


org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)

       at


org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:462)

       at


org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:102)

       at


org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

       at


org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137
)

       at


org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)

       at


org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118
)

       at


org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:102)

       at


org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

       at


org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:109)

       at


org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)

       at


org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

       at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)

       at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)

       at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)

       at


org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:705)

       at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)

       at


org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:683)

       at java.lang.Thread.run(Thread.java:534)








--
Ulrich Nicolas Lissé





--
Ulrich Nicolas Lissé




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>