Orbeon XForms - Retrieve the XML of an instance

109 views Asked by At

I have an XForm developed using Orbeon. Now, on a button click, I need to be able to retrieve the whole of an instance in XML format, store this XML in a node of another instance, and post this to a web service. The web service part, and the button click are all fine, it's the retrieval I'm struggling with.

<xf:instance id="model-xml-instance">
    <form>
      <Timestamp />
      <UserName/>
      <FormXML/>
    </form>
</xf:instance>


<xf:instance id="model-main-instance">
    <form>
      <ControlValue1 />
      <ControlValue2 />
      <ControlValue3 />
    </form>
</xf:instance>

<xf:action ev:event="DOMActivate">
    <!-- Before the submission I need to retrieve the XML of the instance "model-main-instance", and store it in the FormXML node of 'model-xml-instance' -->
    <xf:send submission="My-submission"/>
</xf:action>
1

There are 1 answers

0
avernet On BEST ANSWER

The following should do the trick:

<xf:delete ref="instance('model-xml-instance')/FormXML/*"/>
<xf:insert ref="instance('model-xml-instance')/FormXML" origin="instance('model-main-instance')"/>

And of course, if you know that <FormXML> will always be empty, then you don't need the first <xf:delete>.