base xml

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

base xml

Colin Seaman
Hi,

I am reading in my main instance XML via a series of page-flow events
(the data is coming in via a POST and pased as XML).  This data is then
being passed to my XForm.

There is a small problem with this.  If the data coming in doesn't
contain all the tags referenced in the XForm, the form element will not
be displayed.

For instance, the data coming in could be:

<Document>
<test1>blah</test1>
<test3>another</test3>
</Document>

But the full XML I want to use in the XForm (and what the form elements
are linked to) is:

<Document>
<test1></test1>
<test2></test2>
<test3></test3>
</Document>

Is there anyway to tell the XForm to use another XML file as a basis if
input:data XML doesn't contain the full tag set?

Many thanks,

--
Colin Seaman
Senior Developer
 
Tradocs Ltd,
Tower Point,
44 North Road,
Brighton,
BN1 1YR

email:     [hidden email]
skype:     colin,seaman
telephone: 0870-1417031
website:   http://www.tradocs.net

This email and any files transmitted with it are confidential
and intended solely for the use of the individual or entity to
whom they are addressed. If you have received this email in
error please contact Tradocs. Please note that any views or
opinions presented in this email are solely those of the author
and do not necessarily represent those of the company. Finally,
the recipient should check this email and any attachments for
the presence of viruses. The company accepts no liability for
any damage caused by any virus transmitted by this email.
This content of this email is without prejudice.




--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: base xml

Erik Bruchez
Administrator
Colin,

> I am reading in my main instance XML via a series of page-flow events
> (the data is coming in via a POST and pased as XML).  This data is then
> being passed to my XForm.
>
> There is a small problem with this.  If the data coming in doesn't
> contain all the tags referenced in the XForm, the form element will not
> be displayed.
>
> For instance, the data coming in could be:
>
> <Document>
> <test1>blah</test1>
> <test3>another</test3>
> </Document>
>
> But the full XML I want to use in the XForm (and what the form elements
> are linked to) is:
>
> <Document>
> <test1></test1>
> <test2></test2>
> <test3></test3>
> </Document>
>
> Is there anyway to tell the XForm to use another XML file as a basis if
> input:data XML doesn't contain the full tag set?
You don't have an automatic way: an XForm instance is either obtained
entirely by the XForms engine or not at all. There is no magic merging
feature.

But you could certainly find ways to complete the instance, either
before passing it to XForms, or within XForms itself upon receiving the
xforms-ready event. For example:

<xforms:instance id="main">
  <Document>
   <test1></test1>
   <test2></test2>
   <test3></test3>
  </Document>
</xforms:instance>

<xforms:instance id="temp">
   ... here the instance you receive on input:data ...
</xforms:instance>

<xforms:action ev:event="xforms-ready">
   <xforms:setvalue if="instance('temp')/test1"
                    ref="instance('main')/test1"
                    value="instance('temp')/test1"/>
   <xforms:setvalue if="instance('temp')/test2"
                    ref="instance('main')/test2"
                    value="instance('temp')/test2"/>
<xforms:action>

etc. Not very light. You may manage to do something smarter...

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: base xml

Colin Seaman
eek..

Thanks Erik.  I have some pre-parsing routines I can run to get around this.  They're not great, but its good to know that I'm not duplicating my efforts writing this!  It looks like generic XML merge tools are somewhat of a rarity!
Colin Seaman
Senior Developer
 
Tradocs Ltd,
Tower Point,
44 North Road,
Brighton,
BN1 1YR

email:     [hidden email]
skype:     colin,seaman
telephone: 0870-1417031
website:   http://www.tradocs.net

This email and any files transmitted with it are confidential 
and intended solely for the use of the individual or entity to 
whom they are addressed. If you have received this email in 
error please contact Tradocs. Please note that any views or 
opinions presented in this email are solely those of the author 
and do not necessarily represent those of the company. Finally, 
the recipient should check this email and any attachments for 
the presence of viruses. The company accepts no liability for 
any damage caused by any virus transmitted by this email.
This content of this email is without prejudice.


Erik Bruchez wrote:
Colin,

I am reading in my main instance XML via a series of page-flow events (the data is coming in via a POST and pased as XML).  This data is then being passed to my XForm.

There is a small problem with this.  If the data coming in doesn't contain all the tags referenced in the XForm, the form element will not be displayed.

For instance, the data coming in could be:

<Document>
<test1>blah</test1>
<test3>another</test3>
</Document>

But the full XML I want to use in the XForm (and what the form elements are linked to) is:

<Document>
<test1></test1>
<test2></test2>
<test3></test3>
</Document>

Is there anyway to tell the XForm to use another XML file as a basis if input:data XML doesn't contain the full tag set?

You don't have an automatic way: an XForm instance is either obtained entirely by the XForms engine or not at all. There is no magic merging feature.

But you could certainly find ways to complete the instance, either before passing it to XForms, or within XForms itself upon receiving the xforms-ready event. For example:

<xforms:instance id="main">
 <Document>
  <test1></test1>
  <test2></test2>
  <test3></test3>
 </Document>
</xforms:instance>

<xforms:instance id="temp">
  ... here the instance you receive on input:data ...
</xforms:instance>

<xforms:action ev:event="xforms-ready">
  <xforms:setvalue if="instance('temp')/test1"
                   ref="instance('main')/test1"
                   value="instance('temp')/test1"/>
  <xforms:setvalue if="instance('temp')/test2"
                   ref="instance('main')/test2"
                   value="instance('temp')/test2"/>
<xforms:action>

etc. Not very light. You may manage to do something smarter...

-Erik


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