This post was updated on .
Hi,
I'm trying to get a parameter sent via post and bind it to an instance. The parameter contains a String with the XML code of that instance. And in the form I do it like this: <xforms:action ev:event="xforms-ready"> <xforms:insert context="instance('list_paper')" nodeset="item" origin="xxforms:get-request-parameter('list_paper')"/> </xforms:action> But it doesn't work. Using the inspector the instance becomes with this code: <root xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:saxon="http://saxon.sf.net/" xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sql="http://orbeon.org/oxf/xml/sql" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xpl="java:org.orbeon.oxf.pipeline.api.FunctionLibrary" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:exforms="http://www.exforms.org/exf/1-0" xmlns:fb="http://orbeon.org/oxf/xml/form-builder"> <item> <label>titular1</label> <value>0</value> </item> <item> <label>titular2</label> <value>1</value> </item> <item> <label>titular3</label> <value>2</value> </item>& lt;root& gt; & lt;item& gt; & lt;label& gt;titular100& lt;/label& gt; & lt;value& gt;0& lt;/value& gt; & lt;/item& gt; & lt;item& gt; & lt;label& gt;titular200& lt;/label& gt; & lt;value& gt;1& lt;/value& gt; & lt;/item& gt; & lt;item& gt; & lt;label& gt;titular300& lt;/label& gt; & lt;value& gt;2& lt;/value& gt; & lt;/item& gt; & lt;/root& gt; </root> (without the spaces between the gt and lt and the &) It is the default instance hard coded in the form plus the content that comes from parameter. But why is it not binding well? |
Administrator
|
xxforms:get-request-parameter returns a string, and that's what gets
inserted into the instance What you want is to parse the string before inserting. Try: <xforms:insert context="instance('list_paper')" nodeset="item" origin="saxon:parse(xxforms:get-request-parameter('list_paper'))"/> And make sure you have xmlns:saxon="http://saxon.sf.net/" declared. -Erik On Mon, Oct 22, 2012 at 11:24 AM, Henrique Barros <[hidden email]> wrote: > Hi, > > I'm trying to get a parameter sent via post and bind it to an instance. The > parameter contains a String with the XML code of that instance. And in the > form I do it like this: > > <xforms:action ev:event="xforms-ready"> > <xforms:insert > context="instance('list_paper')" nodeset="item" > origin="xxforms:get-request-parameter('list_paper')"/> > </xforms:action> > > But it doesn't work. Using the inspector the instance becomes with this > code: > > > <root xmlns:xbl="http://www.w3.org/ns/xbl" > xmlns:xhtml="http://www.w3.org/1999/xhtml" > xmlns:saxon="http://saxon.sf.net/" > xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:fr="http://orbeon.org/oxf/xml/form-runner" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:sql="http://orbeon.org/oxf/xml/sql" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" > xmlns:xi="http://www.w3.org/2001/XInclude" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xpl="java:org.orbeon.oxf.pipeline.api.FunctionLibrary" > xmlns:xforms="http://www.w3.org/2002/xforms" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:exforms="http://www.exforms.org/exf/1-0" > xmlns:fb="http://orbeon.org/oxf/xml/form-builder"> > <item> > <label>titular1</label> > <value>0</value> > </item> > <item> > <label>titular2</label> > <value>1</value> > </item> > <item> > <label>titular3</label> > <value>2</value> > </item><root> > <item> > <label>titular100</label> > <value>0</value> > </item> > <item> > <label>titular200</label> > <value>1</value> > </item> > <item> > <label>titular300</label> > <value>2</value> > </item> > </root> > </root> > > It is the default instance hard coded in the form plus the content that > comes from parameter. But why is it not binding well? > > > > > > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Get-posted-instance-via-String-xml-tp4655885.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Hi,
Thank you very much for the solution! There is another solution though, is passing attribute xml via Document instead of String and using this code in the form: <xforms:action ev:event="xforms-model-construct-done"> <xforms:insert nodeset="instance('list_paper')" origin="xxforms:get-request-attribute('list_paper')"/> </xforms:action> Thanks, Henrique Barros |
Free forum by Nabble | Edit this page |