When I persist my instance the XML data is inverted

classic Classic list List threaded Threaded
11 messages Options
mar
Reply | Threaded
Open this post in threaded view
|

When I persist my instance the XML data is inverted

mar
All,
 

For some reason when I persist my instance the XML data is inverted. If anyone can tell me why this is happening and how to correct it I would greatly appreciate it.

 

The model looks like:

 

<xforms:model id=”rootModel”>

 <xforms:instance id=”my-instance”>

  <my-instance-main>

    <books>

     <book>

      <title/>

      <author/>

     </book>

    </books>

    <houses>

     <house>

      <address/>

      <sqfeet/>

     </house>

    </houses>

  </my-instance-main>

 </xforms:instance>

</xforms:model>

 

The data is persisted via:

 

<xforms:submission id="save-submission-xml" ref="xxforms:instance('my-instance')" resource="/exist/rest/db/orbeon/xforms-sr/addServers-instance.xml" method="put" replace="none">

</xforms:submission>

 

I don’t understand why the <houses> element is coming before the <books> element.

 

<my-instance-main>

<houses>

  <house>

   <address/>

   <sqfeet/>

  </house>

 </houses>

 <books>

  <book>

   <title/>

   <author/>

  </book>

 </books>

</my-instance-main>

 



--
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
Reply | Threaded
Open this post in threaded view
|

Re: When I persist my instance the XML data is inverted

Ethan Gruber
Not sure if/why it would make any difference, but is there a reason you're using ref="xxforms:instance('my-instance')" instead of ref="instance('my-instance')" and the resource attribute instead of action?

Ethan

On Fri, Jan 8, 2010 at 5:37 PM, Schwartzman, Martin <[hidden email]> wrote:
All,
 

For some reason when I persist my instance the XML data is inverted. If anyone can tell me why this is happening and how to correct it I would greatly appreciate it.

 

The model looks like:

 

<xforms:model id=”rootModel”>

 <xforms:instance id=”my-instance”>

  <my-instance-main>

    <books>

     <book>

      <title/>

      <author/>

     </book>

    </books>

    <houses>

     <house>

      <address/>

      <sqfeet/>

     </house>

    </houses>

  </my-instance-main>

 </xforms:instance>

</xforms:model>

 

The data is persisted via:

 

<xforms:submission id="save-submission-xml" ref="xxforms:instance('my-instance')" resource="/exist/rest/db/orbeon/xforms-sr/addServers-instance.xml" method="put" replace="none">

</xforms:submission>

 

I don’t understand why the <houses> element is coming before the <books> element.

 

<my-instance-main>

<houses>

  <house>

   <address/>

   <sqfeet/>

  </house>

 </houses>

 <books>

  <book>

   <title/>

   <author/>

  </book>

 </books>

</my-instance-main>

 



--
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
mar
Reply | Threaded
Open this post in threaded view
|

RE: Re: When I persist my instance the XML data is inverted

mar
Ethan,
 
I'm using the xxforms:instance because I've got multiple models and multiple instances in those models. xxforms:instance is supposed to find the instance regardless of the model. That said, in the example I've posted here instance('my-instance') works as well. I used the resource attribute because that is what's used in the tutorial example. I've tried using the action attribute instead but it persists the data inverted as well (no change). 

From: Ethan Gruber [mailto:[hidden email]]
Sent: Friday, January 08, 2010 5:16 PM
To: [hidden email]
Subject: [ops-users] Re: When I persist my instance the XML data is inverted

Not sure if/why it would make any difference, but is there a reason you're using ref="xxforms:instance('my-instance')" instead of ref="instance('my-instance')" and the resource attribute instead of action?

Ethan

On Fri, Jan 8, 2010 at 5:37 PM, Schwartzman, Martin <[hidden email]> wrote:
All,
 

For some reason when I persist my instance the XML data is inverted. If anyone can tell me why this is happening and how to correct it I would greatly appreciate it.

 

The model looks like:

 

<xforms:model id=”rootModel”>

 <xforms:instance id=”my-instance”>

  <my-instance-main>

    <books>

     <book>

      <title/>

      <author/>

     </book>

    </books>

    <houses>

     <house>

      <address/>

      <sqfeet/>

     </house>

    </houses>

  </my-instance-main>

 </xforms:instance>

</xforms:model>

 

The data is persisted via:

 

<xforms:submission id="save-submission-xml" ref="xxforms:instance('my-instance')" resource="/exist/rest/db/orbeon/xforms-sr/addServers-instance.xml" method="put" replace="none">

</xforms:submission>

 

I don’t understand why the <houses> element is coming before the <books> element.

 

<my-instance-main>

<houses>

  <house>

   <address/>

   <sqfeet/>

  </house>

 </houses>

 <books>

  <book>

   <title/>

   <author/>

  </book>

 </books>

</my-instance-main>

 



--
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
Reply | Threaded
Open this post in threaded view
|

Re: When I persist my instance the XML data is inverted

Alessandro  Vernet
Administrator
In reply to this post by mar
Martin,

I don't see any reason why this would happen. I recommend you enable the XForms inspector, and check that the order is correct just before the submission happens. If it is, the use a tool like tcpmon to see what goes over HTTP, to check that the order is indeed changed. If you can confirm this, then could you create an XForms sandbox test case that shows this behavior?

Alex



On Jan 8, 2010, at 3:37 PM, "Schwartzman, Martin" <[hidden email]> wrote:

All,
 

For some reason when I persist my instance the XML data is inverted. If anyone can tell me why this is happening and how to correct it I would greatly appreciate it.

 

The model looks like:

 

<xforms:model id=”rootModel”>

 <xforms:instance id=”my-instance”>

  <my-instance-main>

    <books>

     <book>

      <title/>

      <author/>

     </book>

    </books>

    <houses>

     <house>

      <address/>

      <sqfeet/>

     </house>

    </houses>

  </my-instance-main>

 </xforms:instance>

</xforms:model>

 

The data is persisted via:

 

<xforms:submission id="save-submission-xml" ref="xxforms:instance('my-instance')" resource="/exist/rest/db/orbeon/xforms-sr/addServers-instance.xml" method="put" replace="none">

</xforms:submission>

 

I don’t understand why the <houses> element is coming before the <books> element.

 

<my-instance-main>

<houses>

  <house>

   <address/>

   <sqfeet/>

  </house>

 </houses>

 <books>

  <book>

   <title/>

   <author/>

  </book>

 </books>

</my-instance-main>

 


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
mar
Reply | Threaded
Open this post in threaded view
|

RE: Re: When I persist my instance the XML data is inverted

mar
I found the cause of the problem which as it turns out has nothing to do with the xforms:submission. I was putting the instance together dynamically at xforms-ready time. The order that happens in my xform is bottom up not top down as I had assumed. I switched the order and changed the event to xforms-model-construct-done (had to change the event because I dynamically add templates to templates and it has to happen in a certain specific order) and things seem to be working.
 
Thanks.
 
Martin


From: Alessandro Vernet [mailto:[hidden email]]
Sent: Monday, January 11, 2010 12:55 PM
To: [hidden email]
Subject: [ops-users] Re: When I persist my instance the XML data is inverted

Martin,

I don't see any reason why this would happen. I recommend you enable the XForms inspector, and check that the order is correct just before the submission happens. If it is, the use a tool like tcpmon to see what goes over HTTP, to check that the order is indeed changed. If you can confirm this, then could you create an XForms sandbox test case that shows this behavior?

Alex



On Jan 8, 2010, at 3:37 PM, "Schwartzman, Martin" <[hidden email]> wrote:

All,
 

For some reason when I persist my instance the XML data is inverted. If anyone can tell me why this is happening and how to correct it I would greatly appreciate it.

The model looks like:

<xforms:model id=”rootModel”>

 <xforms:instance id=”my-instance”>

  <my-instance-main>

    <books>

     <book>

      <title/>

      <author/>

     </book>

    </books>

    <houses>

     <house>

      <address/>

      <sqfeet/>

     </house>

    </houses>

  </my-instance-main>

 </xforms:instance>

</xforms:model>

The data is persisted via:

<xforms:submission id="save-submission-xml" ref="xxforms:instance('my-instance')" resource="/exist/rest/db/orbeon/xforms-sr/addServers-instance.xml" method="put" replace="none">

</xforms:submission>

I don’t understand why the <houses> element is coming before the <books> element.

<my-instance-main>

<houses>

  <house>

   <address/>

   <sqfeet/>

  </house>

 </houses>

 <books>

  <book>

   <title/>

   <author/>

  </book>

 </books>

</my-instance-main>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
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
mar
Reply | Threaded
Open this post in threaded view
|

RE: Re: When I persist my instance the XML data is inverted

mar
In reply to this post by Alessandro Vernet
Alex,
 
Is there a way to insert an element into a instance as the last element
in the instance (in document order) instead of the first? I tried:

<xforms:action ev:event="xforms-ready">
  <xforms:insert
context="xxforms:instance('addServers-instance')/addServer"
nodeset="contacts-list"
origin="xxforms:instance('addServer-contacts-list-instance')"
at="last()" position="after" />
</xforms:action>

But this adds the addDatabase-contacts-list-instance elements before the
initial <serverOperatingSystem> element in the addServer element.

<addServer sectionLabel="Add Server Header">
 <contacts-list>
  <contacts>
   <contactName/>
   <phoneNumber/>
   <emailAddress/>
   <totalCost/>
  </contacts>
 </contacts-list>
 <serverOperatingSystem>windows</serverOperatingSystem>
</addServer>


Thanks.

Martin
________________________________

From: Alessandro Vernet [mailto:[hidden email]]
Sent: Monday, January 11, 2010 12:55 PM
To: [hidden email]
Subject: [ops-users] Re: When I persist my instance the XML data is
inverted


Martin,

I don't see any reason why this would happen. I recommend you enable the
XForms inspector, and check that the order is correct just before the
submission happens. If it is, the use a tool like tcpmon to see what
goes over HTTP, to check that the order is indeed changed. If you can
confirm this, then could you create an XForms sandbox test case that
shows this behavior?

Alex



On Jan 8, 2010, at 3:37 PM, "Schwartzman, Martin"
<[hidden email]> wrote:



        All,
         
        For some reason when I persist my instance the XML data is
inverted. If anyone can tell me why this is happening and how to correct
it I would greatly appreciate it.

                The model looks like:

                <xforms:model id="rootModel">

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

          <my-instance-main>

            <books>

             <book>

              <title/>

              <author/>

             </book>

            </books>

            <houses>

             <house>

              <address/>

              <sqfeet/>

             </house>

            </houses>

          </my-instance-main>

         </xforms:instance>

        </xforms:model>

                The data is persisted via:

                <xforms:submission id="save-submission-xml"
ref="xxforms:instance('my-instance')"
resource="/exist/rest/db/orbeon/xforms-sr/addServers-instance.xml"
method="put" replace="none">

        </xforms:submission>

                I don't understand why the <houses> element is coming
before the <books> element.

                <my-instance-main>

        <houses>

          <house>

           <address/>

           <sqfeet/>

          </house>

         </houses>

         <books>

          <book>

           <title/>

           <author/>

          </book>

         </books>

        </my-instance-main>

                       
        --
        You receive this message as a subscriber of the
[hidden email] mailing list.
        To unsubscribe: <mailto:[hidden email]>
mailto:[hidden email]
        For general help: <mailto:[hidden email]?subject=help>
mailto:[hidden email]?subject=help
        OW2 mailing lists service home page: <http://www.ow2.org/wws>
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
Reply | Threaded
Open this post in threaded view
|

Re: RE: Re: When I persist my instance the XML data is inverted

Ethan Gruber
Martin,

try nodeset="contacts-list/child::node()[last()]".  I think that ought to insert an instance after the last <contacts> in the <contact-list>. 

Ethan

On Tue, Jan 12, 2010 at 3:31 PM, Schwartzman, Martin <[hidden email]> wrote:
Alex,

Is there a way to insert an element into a instance as the last element
in the instance (in document order) instead of the first? I tried:

<xforms:action ev:event="xforms-ready">
 <xforms:insert
context="xxforms:instance('addServers-instance')/addServer"
nodeset="contacts-list"
origin="xxforms:instance('addServer-contacts-list-instance')"
at="last()" position="after" />
</xforms:action>

But this adds the addDatabase-contacts-list-instance elements before the
initial <serverOperatingSystem> element in the addServer element.

<addServer sectionLabel="Add Server Header">
 <contacts-list>
 <contacts>
  <contactName/>
  <phoneNumber/>
  <emailAddress/>
  <totalCost/>
 </contacts>
 </contacts-list>
 <serverOperatingSystem>windows</serverOperatingSystem>
</addServer>


Thanks.

Martin
________________________________

From: Alessandro Vernet [mailto:[hidden email]]
Sent: Monday, January 11, 2010 12:55 PM
To: [hidden email]
Subject: [ops-users] Re: When I persist my instance the XML data is
inverted


Martin,

I don't see any reason why this would happen. I recommend you enable the
XForms inspector, and check that the order is correct just before the
submission happens. If it is, the use a tool like tcpmon to see what
goes over HTTP, to check that the order is indeed changed. If you can
confirm this, then could you create an XForms sandbox test case that
shows this behavior?

Alex



On Jan 8, 2010, at 3:37 PM, "Schwartzman, Martin"
<[hidden email]> wrote:



       All,

       For some reason when I persist my instance the XML data is
inverted. If anyone can tell me why this is happening and how to correct
it I would greatly appreciate it.

               The model looks like:

               <xforms:model id="rootModel">

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

         <my-instance-main>

           <books>

            <book>

             <title/>

             <author/>

            </book>

           </books>

           <houses>

            <house>

             <address/>

             <sqfeet/>

            </house>

           </houses>

         </my-instance-main>

        </xforms:instance>

       </xforms:model>

               The data is persisted via:

               <xforms:submission id="save-submission-xml"
ref="xxforms:instance('my-instance')"
resource="/exist/rest/db/orbeon/xforms-sr/addServers-instance.xml"
method="put" replace="none">

       </xforms:submission>

               I don't understand why the <houses> element is coming
before the <books> element.

               <my-instance-main>

       <houses>

         <house>

          <address/>

          <sqfeet/>

         </house>

        </houses>

        <books>

         <book>

          <title/>

          <author/>

         </book>

        </books>

       </my-instance-main>


       --
       You receive this message as a subscriber of the
[hidden email] mailing list.
       To unsubscribe: <mailto:[hidden email]>
mailto:[hidden email]
       For general help: <mailto:[hidden email]?subject=help>
mailto:[hidden email]?subject=help
       OW2 mailing lists service home page: <http://www.ow2.org/wws>
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




--
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
mar
Reply | Threaded
Open this post in threaded view
|

RE: Re: RE: Re: When I persist my instance the XML data is inverted

mar
Ethan,
 
I tried
 
<xforms:insert
context="xxforms:instance('addServers-instance')/addServer/child::node()
[last()]" nodeset="contacts-list"
origin="xxforms:instance('addServer-contacts-list-instance')"/>

because I want to add the contacts-list after the
<serverOperatingSystem> element but this failed to add anything.

For grins, I also tried:
<xforms:insert
context="xxforms:instance('addServers-instance')/addServer"
nodeset="contacts-list/child::node()[last()]"
origin="xxforms:instance('addServer-contacts-list-instance')"/>

but this had no effect.

Thanks.

Martin

________________________________

From: Ethan Gruber [mailto:[hidden email]]
Sent: Tuesday, January 12, 2010 2:34 PM
To: [hidden email]
Subject: [ops-users] Re: RE: Re: When I persist my instance the XML data
is inverted


Martin,

try nodeset="contacts-list/child::node()[last()]".  I think that ought
to insert an instance after the last <contacts> in the <contact-list>.  

Ethan


On Tue, Jan 12, 2010 at 3:31 PM, Schwartzman, Martin
<[hidden email]> wrote:


        Alex,
       
        Is there a way to insert an element into a instance as the last
element
        in the instance (in document order) instead of the first? I
tried:
       
        <xforms:action ev:event="xforms-ready">
         <xforms:insert
        context="xxforms:instance('addServers-instance')/addServer"
        nodeset="contacts-list"
        origin="xxforms:instance('addServer-contacts-list-instance')"
        at="last()" position="after" />
        </xforms:action>
       
        But this adds the addDatabase-contacts-list-instance elements
before the
        initial <serverOperatingSystem> element in the addServer
element.
       
        <addServer sectionLabel="Add Server Header">
         <contacts-list>
         <contacts>
          <contactName/>
          <phoneNumber/>
          <emailAddress/>
          <totalCost/>
         </contacts>
         </contacts-list>
         <serverOperatingSystem>windows</serverOperatingSystem>
        </addServer>
       


        Thanks.
       
        Martin
        ________________________________
       
        From: Alessandro Vernet [mailto:[hidden email]]
        Sent: Monday, January 11, 2010 12:55 PM
        To: [hidden email]
       
        Subject: [ops-users] Re: When I persist my instance the XML data
is
       
        inverted
       
       
        Martin,
       
        I don't see any reason why this would happen. I recommend you
enable the
        XForms inspector, and check that the order is correct just
before the
        submission happens. If it is, the use a tool like tcpmon to see
what
        goes over HTTP, to check that the order is indeed changed. If
you can
        confirm this, then could you create an XForms sandbox test case
that
        shows this behavior?
       
        Alex
       
       
       
        On Jan 8, 2010, at 3:37 PM, "Schwartzman, Martin"
        <[hidden email]> wrote:
       
       
       
               All,
       
               For some reason when I persist my instance the XML data
is
        inverted. If anyone can tell me why this is happening and how to
correct
        it I would greatly appreciate it.
       
                       The model looks like:
       
                       <xforms:model id="rootModel">
       
                <xforms:instance id="my-instance">
       
                 <my-instance-main>
       
                   <books>
       
                    <book>
       
                     <title/>
       
                     <author/>
       
                    </book>
       
                   </books>
       
                   <houses>
       
                    <house>
       
                     <address/>
       
                     <sqfeet/>
       
                    </house>
       
                   </houses>
       
                 </my-instance-main>
       
                </xforms:instance>
       
               </xforms:model>
       
                       The data is persisted via:
       
                       <xforms:submission id="save-submission-xml"
        ref="xxforms:instance('my-instance')"
       
resource="/exist/rest/db/orbeon/xforms-sr/addServers-instance.xml"
        method="put" replace="none">
       
               </xforms:submission>
       
                       I don't understand why the <houses> element is
coming
        before the <books> element.
       
                       <my-instance-main>
       
               <houses>
       
                 <house>
       
                  <address/>
       
                  <sqfeet/>
       
                 </house>
       
                </houses>
       
                <books>
       
                 <book>
       
                  <title/>
       
                  <author/>
       
                 </book>
       
                </books>
       
               </my-instance-main>
       
       
               --
               You receive this message as a subscriber of the
        [hidden email] mailing list.
               To unsubscribe: <mailto:[hidden email]>
        mailto:[hidden email]
               For general help: <mailto:[hidden email]?subject=help>
        mailto:[hidden email]?subject=help
               OW2 mailing lists service home page:
<http://www.ow2.org/wws>
        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
       
       




--
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
Reply | Threaded
Open this post in threaded view
|

Re: RE: Re: RE: Re: When I persist my instance the XML data is inverted

Alessandro  Vernet
Administrator
Martin,

I think that this how-to will help (linked below), in particular the  
paragraph about inserting at the end. But of course, the whole thing  
makes a good read! :)

http://wiki.orbeon.com/forms/how-to/repeat-insert-position

Alex



On Jan 12, 2010, at 3:03 PM, "Schwartzman, Martin" <[hidden email]
 > wrote:

> Ethan,
>
> I tried
>
> <xforms:insert
> context="xxforms:instance('addServers-instance')/addServer/
> child::node()
> [last()]" nodeset="contacts-list"
> origin="xxforms:instance('addServer-contacts-list-instance')"/>
>
> because I want to add the contacts-list after the
> <serverOperatingSystem> element but this failed to add anything.
>
> For grins, I also tried:
> <xforms:insert
> context="xxforms:instance('addServers-instance')/addServer"
> nodeset="contacts-list/child::node()[last()]"
> origin="xxforms:instance('addServer-contacts-list-instance')"/>
>
> but this had no effect.
>
> Thanks.
>
> Martin
>
> ________________________________
>
> From: Ethan Gruber [mailto:[hidden email]]
> Sent: Tuesday, January 12, 2010 2:34 PM
> To: [hidden email]
> Subject: [ops-users] Re: RE: Re: When I persist my instance the XML  
> data
> is inverted
>
>
> Martin,
>
> try nodeset="contacts-list/child::node()[last()]".  I think that ought
> to insert an instance after the last <contacts> in the <contact-list>.
>
> Ethan
>
>
> On Tue, Jan 12, 2010 at 3:31 PM, Schwartzman, Martin
> <[hidden email]> wrote:
>
>
>    Alex,
>
>    Is there a way to insert an element into a instance as the last
> element
>    in the instance (in document order) instead of the first? I
> tried:
>
>    <xforms:action ev:event="xforms-ready">
>     <xforms:insert
>    context="xxforms:instance('addServers-instance')/addServer"
>    nodeset="contacts-list"
>    origin="xxforms:instance('addServer-contacts-list-instance')"
>    at="last()" position="after" />
>    </xforms:action>
>
>    But this adds the addDatabase-contacts-list-instance elements
> before the
>    initial <serverOperatingSystem> element in the addServer
> element.
>
>    <addServer sectionLabel="Add Server Header">
>     <contacts-list>
>     <contacts>
>      <contactName/>
>      <phoneNumber/>
>      <emailAddress/>
>      <totalCost/>
>     </contacts>
>     </contacts-list>
>     <serverOperatingSystem>windows</serverOperatingSystem>
>    </addServer>
>
>
>
>    Thanks.
>
>    Martin
>    ________________________________
>
>    From: Alessandro Vernet [mailto:[hidden email]]
>    Sent: Monday, January 11, 2010 12:55 PM
>    To: [hidden email]
>
>    Subject: [ops-users] Re: When I persist my instance the XML data
> is
>
>    inverted
>
>
>    Martin,
>
>    I don't see any reason why this would happen. I recommend you
> enable the
>    XForms inspector, and check that the order is correct just
> before the
>    submission happens. If it is, the use a tool like tcpmon to see
> what
>    goes over HTTP, to check that the order is indeed changed. If
> you can
>    confirm this, then could you create an XForms sandbox test case
> that
>    shows this behavior?
>
>    Alex
>
>
>
>    On Jan 8, 2010, at 3:37 PM, "Schwartzman, Martin"
>    <[hidden email]> wrote:
>
>
>
>           All,
>
>           For some reason when I persist my instance the XML data
> is
>    inverted. If anyone can tell me why this is happening and how to
> correct
>    it I would greatly appreciate it.
>
>                   The model looks like:
>
>                   <xforms:model id="rootModel">
>
>            <xforms:instance id="my-instance">
>
>             <my-instance-main>
>
>               <books>
>
>                <book>
>
>                 <title/>
>
>                 <author/>
>
>                </book>
>
>               </books>
>
>               <houses>
>
>                <house>
>
>                 <address/>
>
>                 <sqfeet/>
>
>                </house>
>
>               </houses>
>
>             </my-instance-main>
>
>            </xforms:instance>
>
>           </xforms:model>
>
>                   The data is persisted via:
>
>                   <xforms:submission id="save-submission-xml"
>    ref="xxforms:instance('my-instance')"
>
> resource="/exist/rest/db/orbeon/xforms-sr/addServers-instance.xml"
>    method="put" replace="none">
>
>           </xforms:submission>
>
>                   I don't understand why the <houses> element is
> coming
>    before the <books> element.
>
>                   <my-instance-main>
>
>           <houses>
>
>             <house>
>
>              <address/>
>
>              <sqfeet/>
>
>             </house>
>
>            </houses>
>
>            <books>
>
>             <book>
>
>              <title/>
>
>              <author/>
>
>             </book>
>
>            </books>
>
>           </my-instance-main>
>
>
>           --
>           You receive this message as a subscriber of the
>    [hidden email] mailing list.
>           To unsubscribe: <mailto:[hidden email]>
>    mailto:[hidden email]
>           For general help: <mailto:[hidden email]?subject=help>
>    mailto:[hidden email]?subject=help
>           OW2 mailing lists service home page:
> <http://www.ow2.org/wws>
>    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
>
>
>
>
>
> --
> 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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
mar
Reply | Threaded
Open this post in threaded view
|

RE: Re: RE: Re: RE: Re: When I persist my instance the XML data is inverted

mar
Alex,

I read that how-to. It does not seem apply to what I'm doing which is
adding elements (in an attempt to get them added in a specific order) to
my instance at xforms-model-construct time. I figured out a way to do it
but it seems, at best, kludge to me. I have to add parent elements first
followed by child elements. So parent elements are done via
<xforms:action ev:event="xforms-model-construct-done">. Child elements
are done via <xforms:action ev:event="xforms-ready">. Elements that need
to come before sibling elements have to have their xforms:actions come
after their sibling elements actions in the xform document.

Below is an example of my solution. If there is a better way please let
me know. The persisted instances needs to be in the following order and
the xforms:action(s) are they only way I've come up with so far to do
it.

<root>
 <addServer>
  <addServer-fields/>
 </addServer>
 <addFilesystem>
  <addFilesystem-fields>
  <<contacts-list/>
 </addFilesystem>
 <addDatabase>
  <addDatabase-fields/>
  <contacts-list/>
 </addDatabase>
</root>

<xforms:action ev:event="xforms-model-construct-done">
 <xforms:insert context="xxforms:instance('addServers-instance')"
nodeset="addDatabase"
origin="xxforms:instance('addDatabase-instance')"/>
</xforms:action>

<xforms:action ev:event="xforms-model-construct-done">
 <xforms:insert context="xxforms:instance('addServers-instance')"
nodeset="addFilesystem"
origin="xxforms:instance('addFilesystem-instance')"/>
</xforms:action>

<xforms:action ev:event="xforms-model-construct-done">
 <xforms:insert context="xxforms:instance('addServers-instance')"
nodeset="addServer" origin="xxforms:instance('addServer-instance')"/>
</xforms:action>

<xforms:action ev:event="xforms-ready">
 <xforms:insert
context="xxforms:instance('addServers-instance')/addDatabase"
nodeset="contacts-list"
origin="xxforms:instance('addDatabase-contacts-list-instance')"/>
</xforms:action>

<xforms:action ev:event="xforms-ready">
 <xforms:insert
context="xxforms:instance('addServers-instance')/addDatabase"
nodeset="addDatabase-fields"
origin="xxforms:instance('addDatabase-field-template')"/>
</xforms:action>

<xforms:action ev:event="xforms-ready">
 <xforms:insert
context="xxforms:instance('addServers-instance')/addFilesystem"
nodeset="contacts-list"
origin="xxforms:instance('addFilesystem-contacts-list-instance')"/>
</xforms:action>

<xforms:action ev:event="xforms-ready">
 <xforms:insert
context="xxforms:instance('addServers-instance')/addFilesystem"
nodeset="addFilesystem-fields"
origin="xxforms:instance('addFilesystem-field-template')"/>
</xforms:action>

<xforms:action ev:event="xforms-ready">
 <xforms:insert
context="xxforms:instance('addServers-instance')/addServer"
nodeset="addServer-fields"
origin="xxforms:instance('addServer-field-template')"/>
</xforms:action>

Thanks.

Martin

-----Original Message-----
From: Alessandro Vernet [mailto:[hidden email]]
Sent: Thursday, January 14, 2010 8:30 PM
To: [hidden email]
Subject: [ops-users] Re: RE: Re: RE: Re: When I persist my instance the
XML data is inverted

Martin,

I think that this how-to will help (linked below), in particular the
paragraph about inserting at the end. But of course, the whole thing
makes a good read! :)

http://wiki.orbeon.com/forms/how-to/repeat-insert-position

Alex



On Jan 12, 2010, at 3:03 PM, "Schwartzman, Martin"
<[hidden email]  > wrote:

> Ethan,
>
> I tried
>
> <xforms:insert
> context="xxforms:instance('addServers-instance')/addServer/
> child::node()
> [last()]" nodeset="contacts-list"
> origin="xxforms:instance('addServer-contacts-list-instance')"/>
>
> because I want to add the contacts-list after the
> <serverOperatingSystem> element but this failed to add anything.
>
> For grins, I also tried:
> <xforms:insert
> context="xxforms:instance('addServers-instance')/addServer"
> nodeset="contacts-list/child::node()[last()]"
> origin="xxforms:instance('addServer-contacts-list-instance')"/>
>
> but this had no effect.
>
> Thanks.
>
> Martin
>
> ________________________________
>
> From: Ethan Gruber [mailto:[hidden email]]
> Sent: Tuesday, January 12, 2010 2:34 PM
> To: [hidden email]
> Subject: [ops-users] Re: RE: Re: When I persist my instance the XML
> data is inverted
>
>
> Martin,
>
> try nodeset="contacts-list/child::node()[last()]".  I think that ought

> to insert an instance after the last <contacts> in the <contact-list>.
>
> Ethan
>
>
> On Tue, Jan 12, 2010 at 3:31 PM, Schwartzman, Martin
> <[hidden email]> wrote:
>
>
>    Alex,
>
>    Is there a way to insert an element into a instance as the last
> element
>    in the instance (in document order) instead of the first? I
> tried:
>
>    <xforms:action ev:event="xforms-ready">
>     <xforms:insert
>    context="xxforms:instance('addServers-instance')/addServer"
>    nodeset="contacts-list"
>    origin="xxforms:instance('addServer-contacts-list-instance')"
>    at="last()" position="after" />
>    </xforms:action>
>
>    But this adds the addDatabase-contacts-list-instance elements
> before the
>    initial <serverOperatingSystem> element in the addServer element.
>
>    <addServer sectionLabel="Add Server Header">
>     <contacts-list>
>     <contacts>
>      <contactName/>
>      <phoneNumber/>
>      <emailAddress/>
>      <totalCost/>
>     </contacts>
>     </contacts-list>
>     <serverOperatingSystem>windows</serverOperatingSystem>
>    </addServer>
>
>
>
>    Thanks.
>
>    Martin
>    ________________________________
>
>    From: Alessandro Vernet [mailto:[hidden email]]
>    Sent: Monday, January 11, 2010 12:55 PM
>    To: [hidden email]
>
>    Subject: [ops-users] Re: When I persist my instance the XML data is
>
>    inverted
>
>
>    Martin,
>
>    I don't see any reason why this would happen. I recommend you
> enable the
>    XForms inspector, and check that the order is correct just before
> the
>    submission happens. If it is, the use a tool like tcpmon to see
> what
>    goes over HTTP, to check that the order is indeed changed. If you
> can
>    confirm this, then could you create an XForms sandbox test case
> that
>    shows this behavior?
>
>    Alex
>
>
>
>    On Jan 8, 2010, at 3:37 PM, "Schwartzman, Martin"
>    <[hidden email]> wrote:
>
>
>
>           All,
>
>           For some reason when I persist my instance the XML data is
>    inverted. If anyone can tell me why this is happening and how to
> correct
>    it I would greatly appreciate it.
>
>                   The model looks like:
>
>                   <xforms:model id="rootModel">
>
>            <xforms:instance id="my-instance">
>
>             <my-instance-main>
>
>               <books>
>
>                <book>
>
>                 <title/>
>
>                 <author/>
>
>                </book>
>
>               </books>
>
>               <houses>
>
>                <house>
>
>                 <address/>
>
>                 <sqfeet/>
>
>                </house>
>
>               </houses>
>
>             </my-instance-main>
>
>            </xforms:instance>
>
>           </xforms:model>
>
>                   The data is persisted via:
>
>                   <xforms:submission id="save-submission-xml"
>    ref="xxforms:instance('my-instance')"
>
> resource="/exist/rest/db/orbeon/xforms-sr/addServers-instance.xml"
>    method="put" replace="none">
>
>           </xforms:submission>
>
>                   I don't understand why the <houses> element is
> coming
>    before the <books> element.
>
>                   <my-instance-main>
>
>           <houses>
>
>             <house>
>
>              <address/>
>
>              <sqfeet/>
>
>             </house>
>
>            </houses>
>
>            <books>
>
>             <book>
>
>              <title/>
>
>              <author/>
>
>             </book>
>
>            </books>
>
>           </my-instance-main>
>
>
>           --
>           You receive this message as a subscriber of the
>    [hidden email] mailing list.
>           To unsubscribe: <mailto:[hidden email]>
>    mailto:[hidden email]
>           For general help: <mailto:[hidden email]?subject=help>
>    mailto:[hidden email]?subject=help
>           OW2 mailing lists service home page:
> <http://www.ow2.org/wws>
>    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
>
>
>
>
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: RE: Re: RE: Re: RE: Re: When I persist my instance the XML data is inverted

Alessandro  Vernet
Administrator
Martin,

I see syntax errors in this XML, most likely typos. Could you submit a
minimal example that runs in the XForms sandbox and that shows this?

Alex

On Fri, Jan 15, 2010 at 10:04 AM, Schwartzman, Martin
<[hidden email]> wrote:

> Alex,
>
> I read that how-to. It does not seem apply to what I'm doing which is
> adding elements (in an attempt to get them added in a specific order) to
> my instance at xforms-model-construct time. I figured out a way to do it
> but it seems, at best, kludge to me. I have to add parent elements first
> followed by child elements. So parent elements are done via
> <xforms:action ev:event="xforms-model-construct-done">. Child elements
> are done via <xforms:action ev:event="xforms-ready">. Elements that need
> to come before sibling elements have to have their xforms:actions come
> after their sibling elements actions in the xform document.
>
> Below is an example of my solution. If there is a better way please let
> me know. The persisted instances needs to be in the following order and
> the xforms:action(s) are they only way I've come up with so far to do
> it.
>
> <root>
>  <addServer>
>  <addServer-fields/>
>  </addServer>
>  <addFilesystem>
>  <addFilesystem-fields>
>  <<contacts-list/>
>  </addFilesystem>
>  <addDatabase>
>  <addDatabase-fields/>
>  <contacts-list/>
>  </addDatabase>
> </root>
>
> <xforms:action ev:event="xforms-model-construct-done">
>  <xforms:insert context="xxforms:instance('addServers-instance')"
> nodeset="addDatabase"
> origin="xxforms:instance('addDatabase-instance')"/>
> </xforms:action>
>
> <xforms:action ev:event="xforms-model-construct-done">
>  <xforms:insert context="xxforms:instance('addServers-instance')"
> nodeset="addFilesystem"
> origin="xxforms:instance('addFilesystem-instance')"/>
> </xforms:action>
>
> <xforms:action ev:event="xforms-model-construct-done">
>  <xforms:insert context="xxforms:instance('addServers-instance')"
> nodeset="addServer" origin="xxforms:instance('addServer-instance')"/>
> </xforms:action>
>
> <xforms:action ev:event="xforms-ready">
>  <xforms:insert
> context="xxforms:instance('addServers-instance')/addDatabase"
> nodeset="contacts-list"
> origin="xxforms:instance('addDatabase-contacts-list-instance')"/>
> </xforms:action>
>
> <xforms:action ev:event="xforms-ready">
>  <xforms:insert
> context="xxforms:instance('addServers-instance')/addDatabase"
> nodeset="addDatabase-fields"
> origin="xxforms:instance('addDatabase-field-template')"/>
> </xforms:action>
>
> <xforms:action ev:event="xforms-ready">
>  <xforms:insert
> context="xxforms:instance('addServers-instance')/addFilesystem"
> nodeset="contacts-list"
> origin="xxforms:instance('addFilesystem-contacts-list-instance')"/>
> </xforms:action>
>
> <xforms:action ev:event="xforms-ready">
>  <xforms:insert
> context="xxforms:instance('addServers-instance')/addFilesystem"
> nodeset="addFilesystem-fields"
> origin="xxforms:instance('addFilesystem-field-template')"/>
> </xforms:action>
>
> <xforms:action ev:event="xforms-ready">
>  <xforms:insert
> context="xxforms:instance('addServers-instance')/addServer"
> nodeset="addServer-fields"
> origin="xxforms:instance('addServer-field-template')"/>
> </xforms:action>
>
> Thanks.
>
> Martin
>
> -----Original Message-----
> From: Alessandro Vernet [mailto:[hidden email]]
> Sent: Thursday, January 14, 2010 8:30 PM
> To: [hidden email]
> Subject: [ops-users] Re: RE: Re: RE: Re: When I persist my instance the
> XML data is inverted
>
> Martin,
>
> I think that this how-to will help (linked below), in particular the
> paragraph about inserting at the end. But of course, the whole thing
> makes a good read! :)
>
> http://wiki.orbeon.com/forms/how-to/repeat-insert-position
>
> Alex
>
>
>
> On Jan 12, 2010, at 3:03 PM, "Schwartzman, Martin"
> <[hidden email]  > wrote:
>
>> Ethan,
>>
>> I tried
>>
>> <xforms:insert
>> context="xxforms:instance('addServers-instance')/addServer/
>> child::node()
>> [last()]" nodeset="contacts-list"
>> origin="xxforms:instance('addServer-contacts-list-instance')"/>
>>
>> because I want to add the contacts-list after the
>> <serverOperatingSystem> element but this failed to add anything.
>>
>> For grins, I also tried:
>> <xforms:insert
>> context="xxforms:instance('addServers-instance')/addServer"
>> nodeset="contacts-list/child::node()[last()]"
>> origin="xxforms:instance('addServer-contacts-list-instance')"/>
>>
>> but this had no effect.
>>
>> Thanks.
>>
>> Martin
>>
>> ________________________________
>>
>> From: Ethan Gruber [mailto:[hidden email]]
>> Sent: Tuesday, January 12, 2010 2:34 PM
>> To: [hidden email]
>> Subject: [ops-users] Re: RE: Re: When I persist my instance the XML
>> data is inverted
>>
>>
>> Martin,
>>
>> try nodeset="contacts-list/child::node()[last()]".  I think that ought
>
>> to insert an instance after the last <contacts> in the <contact-list>.
>>
>> Ethan
>>
>>
>> On Tue, Jan 12, 2010 at 3:31 PM, Schwartzman, Martin
>> <[hidden email]> wrote:
>>
>>
>>    Alex,
>>
>>    Is there a way to insert an element into a instance as the last
>> element
>>    in the instance (in document order) instead of the first? I
>> tried:
>>
>>    <xforms:action ev:event="xforms-ready">
>>     <xforms:insert
>>    context="xxforms:instance('addServers-instance')/addServer"
>>    nodeset="contacts-list"
>>    origin="xxforms:instance('addServer-contacts-list-instance')"
>>    at="last()" position="after" />
>>    </xforms:action>
>>
>>    But this adds the addDatabase-contacts-list-instance elements
>> before the
>>    initial <serverOperatingSystem> element in the addServer element.
>>
>>    <addServer sectionLabel="Add Server Header">
>>     <contacts-list>
>>     <contacts>
>>      <contactName/>
>>      <phoneNumber/>
>>      <emailAddress/>
>>      <totalCost/>
>>     </contacts>
>>     </contacts-list>
>>     <serverOperatingSystem>windows</serverOperatingSystem>
>>    </addServer>
>>
>>
>>
>>    Thanks.
>>
>>    Martin
>>    ________________________________
>>
>>    From: Alessandro Vernet [mailto:[hidden email]]
>>    Sent: Monday, January 11, 2010 12:55 PM
>>    To: [hidden email]
>>
>>    Subject: [ops-users] Re: When I persist my instance the XML data is
>>
>>    inverted
>>
>>
>>    Martin,
>>
>>    I don't see any reason why this would happen. I recommend you
>> enable the
>>    XForms inspector, and check that the order is correct just before
>> the
>>    submission happens. If it is, the use a tool like tcpmon to see
>> what
>>    goes over HTTP, to check that the order is indeed changed. If you
>> can
>>    confirm this, then could you create an XForms sandbox test case
>> that
>>    shows this behavior?
>>
>>    Alex
>>
>>
>>
>>    On Jan 8, 2010, at 3:37 PM, "Schwartzman, Martin"
>>    <[hidden email]> wrote:
>>
>>
>>
>>           All,
>>
>>           For some reason when I persist my instance the XML data is
>>    inverted. If anyone can tell me why this is happening and how to
>> correct
>>    it I would greatly appreciate it.
>>
>>                   The model looks like:
>>
>>                   <xforms:model id="rootModel">
>>
>>            <xforms:instance id="my-instance">
>>
>>             <my-instance-main>
>>
>>               <books>
>>
>>                <book>
>>
>>                 <title/>
>>
>>                 <author/>
>>
>>                </book>
>>
>>               </books>
>>
>>               <houses>
>>
>>                <house>
>>
>>                 <address/>
>>
>>                 <sqfeet/>
>>
>>                </house>
>>
>>               </houses>
>>
>>             </my-instance-main>
>>
>>            </xforms:instance>
>>
>>           </xforms:model>
>>
>>                   The data is persisted via:
>>
>>                   <xforms:submission id="save-submission-xml"
>>    ref="xxforms:instance('my-instance')"
>>
>> resource="/exist/rest/db/orbeon/xforms-sr/addServers-instance.xml"
>>    method="put" replace="none">
>>
>>           </xforms:submission>
>>
>>                   I don't understand why the <houses> element is
>> coming
>>    before the <books> element.
>>
>>                   <my-instance-main>
>>
>>           <houses>
>>
>>             <house>
>>
>>              <address/>
>>
>>              <sqfeet/>
>>
>>             </house>
>>
>>            </houses>
>>
>>            <books>
>>
>>             <book>
>>
>>              <title/>
>>
>>              <author/>
>>
>>             </book>
>>
>>            </books>
>>
>>           </my-instance-main>
>>
>>
>>           --
>>           You receive this message as a subscriber of the
>>    [hidden email] mailing list.
>>           To unsubscribe: <mailto:[hidden email]>
>>    mailto:[hidden email]
>>           For general help: <mailto:[hidden email]?subject=help>
>>    mailto:[hidden email]?subject=help
>>           OW2 mailing lists service home page:
>> <http://www.ow2.org/wws>
>>    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
>>
>>
>>
>>
>>
>> --
>> 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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet