Unable to trigger action when using XML Schemas

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

Unable to trigger action when using XML Schemas

Jacques-Alexandre Gerber
Hi,
 
I have an XForm document (see attached form.xml) that I would like to validate with an XML schema (see attached testForm.xsd). If I remove the schema attribute in my xforms:model element, the form works well: clicking the submit button calls the submit.xpl pipeline, which produces XML that is used to enter a value in the text input. When I put the schema attribute back, it appears that clicking the button would no longer call the submit.xpl pipeline. I guess the XML schema might not be correct to allow this to work properly, but I could not figure out how to solve this problem.
 
Any feedback would be much appreciated. I guess this should be a quite common usage of XForm, or not?
 
Thanks in advance,
 
JAG


--
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

submit.xpl (725 bytes) Download Attachment
testForm.xsd (857 bytes) Download Attachment
form.xml (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Unable to trigger action when using XML Schemas

Erik Bruchez
Administrator
JAG,

I don't think your messaged got an answer. The solution is simple:
your schema has a targetNamespace="http://www.orbeon.com/test"
attribute, which means your instances must be in that namespace
too. One way of doing this is to write this instead:

   <xforms:instance id="taskoutput">
       <output xmlns="http://www.orbeon.com/test">
           <notes/>
       </output>
   </xforms:instance>
   <xforms:instance id="data">
       <data xmlns="http://www.orbeon.com/test">
           <name/>
       </data>
   </xforms:instance>
   <xforms:instance id="actionOutput">
       <actionOutput xmlns="http://www.orbeon.com/test">
           <value/>
       </actionOutput>
   </xforms:instance>

Also, you have to use that namespace in XPath expressions. So map your
namespace to a "test" prefix, for example:

   <xhtml:html xmlns:test="http://www.orbeon.com/test" ...>

Then:

   <xforms:input ref="instance('data')/test:name"/>

and:

   <xforms:setvalue ref="instance('data')/test:name"
     value="instance('actionOutput')/test:value"/>

This way your code works.

Note that we now log invalid instances upon submission. This should
facilitate debugging! To see this message, uncomment the following in
log4j.xml:

<category name="org.orbeon.oxf.xforms.processor.XFormsServer">
     <priority value="debug"/>
</category>

-Erik

Jacques-Alexandre Gerber wrote:
 > Hi,
 >
 > I have an XForm document (see attached form.xml) that I would like to
 > validate with an XML schema (see attached testForm.xsd). If I remove the
 > schema attribute in my xforms:model element, the form works well:
 > clicking the submit button calls the submit.xpl pipeline, which produces
 > XML that is used to enter a value in the text input. When I put the
 > schema attribute back, it appears that clicking the button would no
 > longer call the submit.xpl pipeline. I guess the XML schema might not be
 > correct to allow this to work properly, but I could not figure out how
 > to solve this problem.
 >
 > Any feedback would be much appreciated. I guess this should be a quite
 > common usage of XForm, or not?
 >
 > Thanks in advance,
 >
 > JAG



--
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