AW: Re: AW: Re: Re: Problems creating a XFromsModel dynamically

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

AW: Re: AW: Re: Re: Problems creating a XFromsModel dynamically

Peter.Heintz
Hello Alex,
In fact I have anew the problem since yesterday.

So what I am doing is having a static XForm model:

<xforms:model xmlns:xforms="http://www.w3.org/2002/xforms">
        <xforms:instance>
                <form>
                        <action/>
                        <dataset>
                                <meal-id/>
                                <name/>
                                <description/>
                                <photo/>
                                <deactivated/>
                        </dataset>
                </form>
        </xforms:instance>
        <xforms:submission method="post"/>
</xforms:model>

This model I intend later to generate dynamically by connecting to an oracle db.

My view is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:local="http://orbeon.org/oxf/xml/local">
        <xsl:template match="/">
                <html>
                <body>
                <xforms:group ref="/form">
                        <table>
                        <tbody>
                                <tr>
                                        <th>ID</th>
                                        <th>Name</th>
                                        <th>Description</th>
                                        <th>Photo</th>
                                        <th>Deactivated</th>
                                </tr>
                                <xforms:repeat nodeset="dataset" id="lineid">
                                <tr>
                                        <td>
                                        <xxforms:choose>
                                                <xxforms:when test="meal-id !=''">
                                                        <xsl:value-of select="'hallo'"/>
                                                </xxforms:when>
                                                <xxforms:otherwise>
                                                        <xsl:value-of select="'...'"/>
                                                </xxforms:otherwise>
                                        </xxforms:choose>
                                        </td>
                                        <td>
                                                <xforms:input ref="name"/>
                                        </td>
                                        <td>
                                                <xforms:textarea ref="description"/>
                                        </td>
                                        <td>
                                                <xsl:value-of select='"t.b.d."'/>
                                        </td>
                                        <td>
                                                <xforms:select ref="deactivated" appearance="full">
                                                <xforms:item>
                                                <xforms:value>true</xforms:value>
                                                </xforms:item>
                                                        </xforms:select>
                                        </td>
                                </tr>
                                </xforms:repeat>
                        </tbody>
                        </table>
                        <table>
                        <tbody>
                                <tr>
                                        <td>
                                                <xforms:submit>
                                                <xforms:label>Save</xforms:label>
                                <xforms:setvalue ref="action">save</xforms:setvalue>
                                                </xforms:submit>
                                        </td>
                                        <td>
                                        <xforms:submit xxforms:appearance="button">
                                        <xforms:label>Insert new line</xforms:label>
                                        <xforms:insert nodeset="dataset" at="last()" position="after"/>
                                        </xforms:submit>
                                        </td>
                                                </tr>
                                                </tbody>
                                        </table>
                                </xforms:group>
                        </body>
                </html>
        </xsl:template>
</xsl:stylesheet>

My PFC looks as follows:

<page id="FoodManager"  path-info="/FridaySnack/FoodManager"
                                xforms="/FridaySnack/FoodManager/XFormsModel.xml"
                                view="/FridaySnack/FoodManager/view.xsl">
                       <action when="/form/action='save'" action="FoodManager/Save.xpl"/>
                               
    </page>

and my save.xpl is:

<?xml version="1.0" encoding="UTF-8"?>
<p:config   xmlns:p="http://www.orbeon.com/oxf/pipeline"
            xmlns:oxf="http://www.orbeon.com/oxf/processors"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <p:param type="input" name="instance" debug="true"/>
    <!--<p:param type="output" name="data"/>-->
    <!--<p:for-each href="#instance" select="/form/dataset" root="test" id="idata">-->
        <p:processor name="oxf:identity">
                <p:input name="data" href="#instance" debug="true"/>
               
                <p:output name="data" id="idata"/>  
            </p:processor>
    <!--</p:for-each>-->
</p:config>



When I press the save button the epilogue instance shows that the action is set but the save.xpl is not called.

Changing the XFormsModel to a dynamic generated shows that the pressing the save button first call the XFromsModel.xpl where the action of cause is not set and then and then the epilogue runs and shows that the action is set to save.
Do you have any idea? Are there some constraints regarding group and repeat elements I should know. Well I am not an XForms specialist.


-Peter

-----Ursprüngliche Nachricht-----
Von: Alessandro Vernet [mailto:[hidden email]]
Gesendet: Montag, 25. Juli 2005 20:16
An: [hidden email]
Betreff: Re: Re: AW: Re: Re: [ops-users] Problems creating a XFromsModel dynamically

--- [hidden email] wrote:
> Thank you for your help.
> My problems are gone. I do not now exactly know why, but is seem that it
> had something to do with the factor that I wrapped the XForms data
> elements twice in an XFroms Group together with something else.
>
> However I am happy to continue my evaluations.

Hi Peter,

I am glad to read that you resolved the problem. And please just let us
know if you stumble again into a similar issue and find a way to reproduce
it. We are interested in this kind of issue even if it is not technically
not a bug, but that better error reporting or documentation could have
avoided the problem altogether.

Alex

--
Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/




--
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: Problems creating a XFromsModel dynamically

Alessandro  Vernet
Administrator
--- [hidden email] wrote:
> When I press the save button the epilogue instance shows that the action
> is set but the save.xpl is not called.
>
> Changing the XFormsModel to a dynamic generated shows that the pressing
> the save button first call the XFromsModel.xpl where the action of cause
> is not set and then and then the epilogue runs and shows that the action
> is set to save.
> Do you have any idea? Are there some constraints regarding group and
> repeat elements I should know. Well I am not an XForms specialist.

Hi Peter,

I have reproduced this locally and in fact your save.xpl is executed, but
since all you have in there is an identity processor connected to the data
output of save.xpl and that the data output is never read, nothing is
execute in the save.xpl and you don't see the debugs you have in that
file.

I have modified it to use a null-serializer and you can see that when you
press on the "save" button the save.xpl is executed. I have put together
all the files for this example in the attached peter.zip (.honest added to
make the mailing list software happy).

Alex

--
Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/

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

peter.zip.honest (4K) Download Attachment
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

RE: Problems creating a XFromsModel dynamically

Alan Skorkin
In reply to this post by Peter.Heintz
RE: [ops-users] Problems creating a XFromsModel dynamically

Hi,

I am trying to do a similar thing (generating xforms model dynamically), but i am getting a NullPointerException
for some reason, here are my files:

PFC:

<config xmlns="http://www.orbeon.com/oxf/controller"
        xmlns:xu="http://www.xmldb.org/xupdate"
        xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
        instance-passing="forward">

    <page id="blah" path-info="/blah" xforms="xforms-dynamic.xpl" view="view2.xsl"/>

    <page id="home" path-info="/">
        <action>
            <result page="blah"/>
        </action>
    </page>

    <page id="layout-css" path-info="/oxf-theme/orbeon-layout.cssd" model="/oxf-theme/orbeon-layout.xpl"/>

    <epilogue url="oxf:/config/epilogue.xpl"/>
</config>

dynamic-xforms.xpl (i am simulating dynamic generation by embedding x-forms model directly in the xpl):

<p:config   xmlns:p="http://www.orbeon.com/oxf/pipeline"
            xmlns:oxf="http://www.orbeon.com/oxf/processors"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xmlns:xforms="http://www.w3.org/2002/xforms">

   <p:param type="output" name="data" debug="true"/>

   <p:processor name="oxf:xml-converter" xmlns:p="http://www.orbeon.com/oxf/pipeline">
      <p:input name="config">
         <config>
            <content-type>application/xml</content-type>
            <encoding>io-8859-1</encoding>
            <version>1.0</version>
         </config>
      </p:input>
      <p:input name="data">
         <xforms:model xmlns:xforms="http://www.w3.org/2002/xforms"
                       xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <xforms:instance>
               <myform>
                  <postcode/>
               </myform>
            </xforms:instance>
         </xforms:model>
      </p:input>
      <p:output name="data" ref="data"/>
   </p:processor>
</p:config>

view.xsl

<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:f="http://orbeon.org/oxf/xml/formatting"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">

   <xsl:template match="/">
      <html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:xforms="http://www.w3.org/2002/xforms"
            xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
            xsl:version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
          <head>
              <title>Form Page 1</title>
          </head>

          <body>
              <xforms:group ref="/myform">
                  <table border="0" cellpadding="1" cellspacing="0">
                     <tr>
                        <td align="left">Please enter postcode:</td>
                        <td>
                           <xforms:input ref="/myform/postcode"/>
                        </td>
                     </tr>
                  </table>
              </xforms:group>
          </body>
      </html>
   </xsl:template>
</xsl:stylesheet>


The Exception I get is as follows:

Type    class java.lang.NullPointerException
Message null
Stack Trace    

java.lang.NullPointerException
        at org.orbeon.oxf.processor.InstanceToParametersProcessor$1.readImpl(InstanceToParametersProcessor.java:73)
        at org.orbeon.oxf.processor.ProcessorImpl$6.read(ProcessorImpl.java:945)
        at org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(ProcessorImpl.java:1106)
        at org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.java:340)
        at org.orbeon.oxf.processor.pipeline.AggregatorProcessor.access$100(AggregatorProcessor.java:32)
        at org.orbeon.oxf.processor.pipeline.AggregatorProcessor$1.readImpl(AggregatorProcessor.java:81)
        at org.orbeon.oxf.processor.ProcessorImpl$6.read(ProcessorImpl.java:945)
        at org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(ProcessorImpl.java:1106)
        at org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.java:340)

...etc...

I seem to be following the guidelines for doing this, yet i keep getting this exception. Can someone advise please.

Thanks

Alan


-----Original Message-----
From: Erik Bruchez [[hidden email]]
Sent: Tuesday, July 19, 2005 10:26 PM
To: [hidden email]
Subject: Re: [ops-users] Problems creating a XFromsModel dynamically


I assume the XPL file you show below is XFormsModel.xpl. I see what the
problem is. You use:

   <p:param type="output" name="instance" debug="true"/>

and:

   <p:output name="data" ref="instance"/>

What you should have is:

   <p:param type="output" name="data" debug="true"/>

and:

   <p:output name="data" ref="data"/>

The output of the XForms model pipeline is an XForms model on the "data"
output, not on the "instance" output.

-Erik

PS: Note that with 3.0, you do this differently as XForms models are
included in the page view. This makes it much easier to generate dynamic
XForms models.

[hidden email] wrote:
> Hello Erik,
> What I think I am doing, is creating a XForms Model containing a XForms instance that contains data from a database.
> So, to answer your first question I think I do create dynamically both.
>
> The data is generated by a pipeline containing a sql processor (see below)
> <?xml version="1.0" encoding="UTF-8"?>
> <p:config   xmlns:p="http://www.orbeon.com/oxf/pipeline"
>             xmlns:oxf="http://www.orbeon.com/oxf/processors"
>             xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>             xmlns:xforms="http://www.w3.org/2002/xforms">
>            
>      <p:param type="output" name="instance" debug="true"/>
>
>     <p:processor name="oxf:sql">
>          <p:input name="datasource" href="../datasource-sql.xml"/> 
>         <p:input name="config">
>             <sql:config xmlns:sql="http://orbeon.org/oxf/xml/sql">
>               <xforms:model>
>                       <xforms:instance>
>                          <form>
>                             <action/>
>                               <sql:connection>
>                                     <sql:execute>
>                                       <sql:update>commit</sql:update>
>                                   </sql:execute>   
>                                   <sql:execute>
>                                         <sql:query>select * from Meal
>                                       </sql:query>
>                                       <sql:results>
>                                          <sql:row-results>
>                                               <dataset>
>                                                       <sql:get-columns format="xml"/>
>                                               </dataset>
>                                          </sql:row-results>
>                                               </sql:results>
>                                  </sql:execute>
>                               </sql:connection>
>                          </form>
>                       </xforms:instance>
>               </xforms:model>
>               </sql:config>
>         </p:input>
>         <p:output name="data" ref="instance"/>  
>     </p:processor>
> </p:config>
>
>
> My PFC looks as follows:
>
>     <page id="FoodManager"  path-info="/FridaySnack/FoodManager"
>                                 xforms="/FridaySnack/FoodManager/XFormsModel.xpl"
>                                 view="/FridaySnack/FoodManager/view.xsl">
> -Peter
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Problems creating a XFromsModel dynamically

Erik Bruchez
Administrator
Alan,

You are using the XML Converter in dynamic-xforms.xpl. This will
result in your XForms model pipeline generating a text document
encapsulated under a root element, as shown here:

   http://www.orbeon.com/ops/doc/reference-formats#d325367e96

This is not a valid XForms model!

It seems to me that your XForms model is static anyway:

 >          <xforms:model xmlns:xforms="http://www.w3.org/2002/xforms"
 >                        xmlns:xs="http://www.w3.org/2001/XMLSchema">
 >             <xforms:instance>
 >                <myform>
 >                   <postcode/>
 >                </myform>
 >             </xforms:instance>
 >          </xforms:model>

So you could just store it into a file called my-xforms-model.xml. But
I assume the goal here is to then get to the point where the model is
actually dynamic.

In that case, use the oxf:identity processor instead.

<p:processor name="oxf:identity">
     <p:input name="data">
         <xforms:model xmlns:xforms="http://www.w3.org/2002/xforms"
                       xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <xforms:instance>
               <myform>
                  <postcode/>
               </myform>
            </xforms:instance>
         </xforms:model>
     </p:input>
     <p:output name="data" ref="data"/>
</p:processor>

Note that with 3.0, you would do this work in the page view based on
data provided by the page model, which is usually much easier to do,
and which allows you to use data from an XML submission in addition.

-Erik

Alan Skorkin wrote:
 > Hi,
 >
 > I am trying to do a similar thing (generating xforms model dynamically),
 > but i am getting a NullPointerException
 > for some reason, here are my files:
 >
 > PFC:
 >
 > <config xmlns="http://www.orbeon.com/oxf/controller"
 >         xmlns:xu="http://www.xmldb.org/xupdate"
 >         xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
 >         instance-passing="forward">
 >
 >     <page id="blah" path-info="/blah" xforms="xforms-dynamic.xpl"
 > view="view2.xsl"/>
 >
 >     <page id="home" path-info="/">
 >         <action>
 >             <result page="blah"/>
 >         </action>
 >     </page>
 >
 >     <page id="layout-css" path-info="/oxf-theme/orbeon-layout.cssd"
 > model="/oxf-theme/orbeon-layout.xpl"/>
 >
 >     <epilogue url="oxf:/config/epilogue.xpl"/>
 > </config>
 >
 > dynamic-xforms.xpl (i am simulating dynamic generation by embedding
 > x-forms model directly in the xpl):
 >
 > <p:config   xmlns:p="http://www.orbeon.com/oxf/pipeline"
 >             xmlns:oxf="http://www.orbeon.com/oxf/processors"
 >             xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 >             xmlns:xforms="http://www.w3.org/2002/xforms">
 >
 >    <p:param type="output" name="data" debug="true"/>
 >
 >    <p:processor name="oxf:xml-converter"
 > xmlns:p="http://www.orbeon.com/oxf/pipeline">
 >       <p:input name="config">
 >          <config>
 >             <content-type>application/xml</content-type>
 >             <encoding>io-8859-1</encoding>
 >             <version>1.0</version>
 >          </config>
 >       </p:input>
 >       <p:input name="data">
 >          <xforms:model xmlns:xforms="http://www.w3.org/2002/xforms"
 >                        xmlns:xs="http://www.w3.org/2001/XMLSchema">
 >             <xforms:instance>
 >                <myform>
 >                   <postcode/>
 >                </myform>
 >             </xforms:instance>
 >          </xforms:model>
 >       </p:input>
 >       <p:output name="data" ref="data"/>
 >    </p:processor>
 > </p:config>
 >
 > view.xsl
 >
 > <xsl:stylesheet version="2.0"
 >     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 >     xmlns:xs="http://www.w3.org/2001/XMLSchema"
 >     xmlns:f="http://orbeon.org/oxf/xml/formatting"
 >     xmlns:xhtml="http://www.w3.org/1999/xhtml"
 >     xmlns:xforms="http://www.w3.org/2002/xforms"
 >     xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">
 >
 >    <xsl:template match="/">
 >       <html xmlns="http://www.w3.org/1999/xhtml"
 >             xmlns:xforms="http://www.w3.org/2002/xforms"
 >             xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
 >             xsl:version="2.0"
 > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 >           <head>
 >               <title>Form Page 1</title>
 >           </head>
 >
 >           <body>
 >               <xforms:group ref="/myform">
 >                   <table border="0" cellpadding="1" cellspacing="0">
 >                      <tr>
 >                         <td align="left">Please enter postcode:</td>
 >                         <td>
 >                            <xforms:input ref="/myform/postcode"/>
 >                         </td>
 >                      </tr>
 >                   </table>
 >               </xforms:group>
 >           </body>
 >       </html>
 >    </xsl:template>
 > </xsl:stylesheet>
 >
 >
 > The Exception I get is as follows:
 >
 > Type    class java.lang.NullPointerException
 > Message null
 > Stack Trace
 >
 > java.lang.NullPointerException
 >         at
 >
org.orbeon.oxf.processor.InstanceToParametersProcessor$1.readImpl(InstanceToParametersProcessor.java:73)

 >
 >         at
 > org.orbeon.oxf.processor.ProcessorImpl$6.read(ProcessorImpl.java:945)
 >         at
 >
org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(ProcessorImpl.java:1106)

 >
 >         at
 >
org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.java:340)

 >
 >         at
 >
org.orbeon.oxf.processor.pipeline.AggregatorProcessor.access$100(AggregatorProcessor.java:32)

 >
 >         at
 >
org.orbeon.oxf.processor.pipeline.AggregatorProcessor$1.readImpl(AggregatorProcessor.java:81)

 >
 >         at
 > org.orbeon.oxf.processor.ProcessorImpl$6.read(ProcessorImpl.java:945)
 >         at
 >
org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(ProcessorImpl.java:1106)

 >
 >         at
 >
org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.java:340)

 >
 >
 > ...etc...
 >
 > I seem to be following the guidelines for doing this, yet i keep getting
 > this exception. Can someone advise please.
 >
 > Thanks
 >
 > Alan
 >
 >
 > -----Original Message-----
 > From: Erik Bruchez [mailto:[hidden email]]
 > Sent: Tuesday, July 19, 2005 10:26 PM
 > To: [hidden email]
 > Subject: Re: [ops-users] Problems creating a XFromsModel dynamically
 >
 >
 > I assume the XPL file you show below is XFormsModel.xpl. I see what the
 > problem is. You use:
 >
 >    <p:param type="output" name="instance" debug="true"/>
 >
 > and:
 >
 >    <p:output name="data" ref="instance"/>
 >
 > What you should have is:
 >
 >    <p:param type="output" name="data" debug="true"/>
 >
 > and:
 >
 >    <p:output name="data" ref="data"/>
 >
 > The output of the XForms model pipeline is an XForms model on the "data"
 > output, not on the "instance" output.
 >
 > -Erik
 >
 > PS: Note that with 3.0, you do this differently as XForms models are
 > included in the page view. This makes it much easier to generate dynamic
 > XForms models.
 >
 > [hidden email] wrote:
 >  > Hello Erik,
 >  > What I think I am doing, is creating a XForms Model containing a
 > XForms instance that contains data from a database.
 >  > So, to answer your first question I think I do create dynamically
both.
 >  >
 >  > The data is generated by a pipeline containing a sql processor (see
 > below)
 >  > <?xml version="1.0" encoding="UTF-8"?>
 >  > <p:config   xmlns:p="http://www.orbeon.com/oxf/pipeline"
 >  >             xmlns:oxf="http://www.orbeon.com/oxf/processors"
 >  >             xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 >  >             xmlns:xforms="http://www.w3.org/2002/xforms">
 >  >
 >  >      <p:param type="output" name="instance" debug="true"/>
 >  >
 >  >     <p:processor name="oxf:sql">
 >  >          <p:input name="datasource" href="../datasource-sql.xml"/>
 >  >         <p:input name="config">
 >  >             <sql:config xmlns:sql="http://orbeon.org/oxf/xml/sql">
 >  >               <xforms:model>
 >  >                       <xforms:instance>
 >  >                          <form>
 >  >                             <action/>
 >  >                               <sql:connection>
 >  >                                     <sql:execute>
 >  >                                       <sql:update>commit</sql:update>
 >  >                                   </sql:execute>
 >  >                                   <sql:execute>
 >  >                                         <sql:query>select * from Meal
 >  >                                       </sql:query>
 >  >                                       <sql:results>
 >  >                                          <sql:row-results>
 >  >                                               <dataset>
 >  >
 > <sql:get-columns format="xml"/>
 >  >                                               </dataset>
 >  >                                          </sql:row-results>
 >  >                                               </sql:results>
 >  >                                  </sql:execute>
 >  >                               </sql:connection>
 >  >                          </form>
 >  >                       </xforms:instance>
 >  >               </xforms:model>
 >  >               </sql:config>
 >  >         </p:input>
 >  >         <p:output name="data" ref="instance"/>
 >  >     </p:processor>
 >  > </p:config>
 >  >
 >  >
 >  > My PFC looks as follows:
 >  >
 >  >     <page id="FoodManager"  path-info="/FridaySnack/FoodManager"
 >  >
 > xforms="/FridaySnack/FoodManager/XFormsModel.xpl"
 >  >
 > view="/FridaySnack/FoodManager/view.xsl">
 >  > -Peter





--
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: Problems creating a XFromsModel dynamically

Alan Skorkin
In reply to this post by Peter.Heintz
RE: [ops-users] Problems creating a XFromsModel dynamically

Thanks this worked!

The goal eventually is to either use the sql processor, or write a custom processor,
which will output an xforms model (this will be generated programatically or from a database)
based on some rules. I am just doing the initial work here.

No doubt more questions will be forthcoming, as I move along, so I appreciate the help :).

-----Original Message-----
From: Erik Bruchez [[hidden email]]
Sent: Friday, August 05, 2005 4:09 AM
To: [hidden email]
Subject: Re: [ops-users] Problems creating a XFromsModel dynamically


Alan,

You are using the XML Converter in dynamic-xforms.xpl. This will
result in your XForms model pipeline generating a text document
encapsulated under a root element, as shown here:

   http://www.orbeon.com/ops/doc/reference-formats#d325367e96

This is not a valid XForms model!

It seems to me that your XForms model is static anyway:

 >          <xforms:model xmlns:xforms="http://www.w3.org/2002/xforms"
 >                        xmlns:xs="http://www.w3.org/2001/XMLSchema">
 >             <xforms:instance>
 >                <myform>
 >                   <postcode/>
 >                </myform>
 >             </xforms:instance>
 >          </xforms:model>

So you could just store it into a file called my-xforms-model.xml. But
I assume the goal here is to then get to the point where the model is
actually dynamic.

In that case, use the oxf:identity processor instead.

<p:processor name="oxf:identity">
     <p:input name="data">
         <xforms:model xmlns:xforms="http://www.w3.org/2002/xforms"
                       xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <xforms:instance>
               <myform>
                  <postcode/>
               </myform>
            </xforms:instance>
         </xforms:model>
     </p:input>
     <p:output name="data" ref="data"/>
</p:processor>

Note that with 3.0, you would do this work in the page view based on
data provided by the page model, which is usually much easier to do,
and which allows you to use data from an XML submission in addition.

-Erik

Alan Skorkin wrote:
 > Hi,
 >
 > I am trying to do a similar thing (generating xforms model dynamically),
 > but i am getting a NullPointerException
 > for some reason, here are my files:
 >
 > PFC:
 >
 > <config xmlns="http://www.orbeon.com/oxf/controller"
 >         xmlns:xu="http://www.xmldb.org/xupdate"
 >         xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
 >         instance-passing="forward">
 >
 >     <page id="blah" path-info="/blah" xforms="xforms-dynamic.xpl"
 > view="view2.xsl"/>
 >
 >     <page id="home" path-info="/">
 >         <action>
 >             <result page="blah"/>
 >         </action>
 >     </page>
 >
 >     <page id="layout-css" path-info="/oxf-theme/orbeon-layout.cssd"
 > model="/oxf-theme/orbeon-layout.xpl"/>
 >
 >     <epilogue url="oxf:/config/epilogue.xpl"/>
 > </config>
 >
 > dynamic-xforms.xpl (i am simulating dynamic generation by embedding
 > x-forms model directly in the xpl):
 >
 > <p:config   xmlns:p="http://www.orbeon.com/oxf/pipeline"
 >             xmlns:oxf="http://www.orbeon.com/oxf/processors"
 >             xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 >             xmlns:xforms="http://www.w3.org/2002/xforms">
 >
 >    <p:param type="output" name="data" debug="true"/>
 >
 >    <p:processor name="oxf:xml-converter"
 > xmlns:p="http://www.orbeon.com/oxf/pipeline">
 >       <p:input name="config">
 >          <config>
 >             <content-type>application/xml</content-type>
 >             <encoding>io-8859-1</encoding>
 >             <version>1.0</version>
 >          </config>
 >       </p:input>
 >       <p:input name="data">
 >          <xforms:model xmlns:xforms="http://www.w3.org/2002/xforms"
 >                        xmlns:xs="http://www.w3.org/2001/XMLSchema">
 >             <xforms:instance>
 >                <myform>
 >                   <postcode/>
 >                </myform>
 >             </xforms:instance>
 >          </xforms:model>
 >       </p:input>
 >       <p:output name="data" ref="data"/>
 >    </p:processor>
 > </p:config>
 >
 > view.xsl
 >
 > <xsl:stylesheet version="2.0"
 >     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 >     xmlns:xs="http://www.w3.org/2001/XMLSchema"
 >     xmlns:f="http://orbeon.org/oxf/xml/formatting"
 >     xmlns:xhtml="http://www.w3.org/1999/xhtml"
 >     xmlns:xforms="http://www.w3.org/2002/xforms"
 >     xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">
 >
 >    <xsl:template match="/">
 >       <html xmlns="http://www.w3.org/1999/xhtml"
 >             xmlns:xforms="http://www.w3.org/2002/xforms"
 >             xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
 >             xsl:version="2.0"
 > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 >           <head>
 >               <title>Form Page 1</title>
 >           </head>
 >
 >           <body>
 >               <xforms:group ref="/myform">
 >                   <table border="0" cellpadding="1" cellspacing="0">
 >                      <tr>
 >                         <td align="left">Please enter postcode:</td>
 >                         <td>
 >                            <xforms:input ref="/myform/postcode"/>
 >                         </td>
 >                      </tr>
 >                   </table>
 >               </xforms:group>
 >           </body>
 >       </html>
 >    </xsl:template>
 > </xsl:stylesheet>
 >
 >
 > The Exception I get is as follows:
 >
 > Type    class java.lang.NullPointerException
 > Message null
 > Stack Trace
 >
 > java.lang.NullPointerException
 >         at
 >
org.orbeon.oxf.processor.InstanceToParametersProcessor$1.readImpl(InstanceToParametersProcessor.java:73)

 >
 >         at
 > org.orbeon.oxf.processor.ProcessorImpl$6.read(ProcessorImpl.java:945)
 >         at
 >
org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(ProcessorImpl.java:1106)

 >
 >         at
 >
org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.java:340)

 >
 >         at
 >
org.orbeon.oxf.processor.pipeline.AggregatorProcessor.access$100(AggregatorProcessor.java:32)

 >
 >         at
 >
org.orbeon.oxf.processor.pipeline.AggregatorProcessor$1.readImpl(AggregatorProcessor.java:81)

 >
 >         at
 > org.orbeon.oxf.processor.ProcessorImpl$6.read(ProcessorImpl.java:945)
 >         at
 >
org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(ProcessorImpl.java:1106)

 >
 >         at
 >
org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.java:340)

 >
 >
 > ...etc...
 >
 > I seem to be following the guidelines for doing this, yet i keep getting
 > this exception. Can someone advise please.
 >
 > Thanks
 >
 > Alan
 >
 >
 > -----Original Message-----
 > From: Erik Bruchez [[hidden email]]
 > Sent: Tuesday, July 19, 2005 10:26 PM
 > To: [hidden email]
 > Subject: Re: [ops-users] Problems creating a XFromsModel dynamically
 >
 >
 > I assume the XPL file you show below is XFormsModel.xpl. I see what the
 > problem is. You use:
 >
 >    <p:param type="output" name="instance" debug="true"/>
 >
 > and:
 >
 >    <p:output name="data" ref="instance"/>
 >
 > What you should have is:
 >
 >    <p:param type="output" name="data" debug="true"/>
 >
 > and:
 >
 >    <p:output name="data" ref="data"/>
 >
 > The output of the XForms model pipeline is an XForms model on the "data"
 > output, not on the "instance" output.
 >
 > -Erik
 >
 > PS: Note that with 3.0, you do this differently as XForms models are
 > included in the page view. This makes it much easier to generate dynamic
 > XForms models.
 >
 > [hidden email] wrote:
 >  > Hello Erik,
 >  > What I think I am doing, is creating a XForms Model containing a
 > XForms instance that contains data from a database.
 >  > So, to answer your first question I think I do create dynamically
both.
 >  >
 >  > The data is generated by a pipeline containing a sql processor (see
 > below)
 >  > <?xml version="1.0" encoding="UTF-8"?>
 >  > <p:config   xmlns:p="http://www.orbeon.com/oxf/pipeline"
 >  >             xmlns:oxf="http://www.orbeon.com/oxf/processors"
 >  >             xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 >  >             xmlns:xforms="http://www.w3.org/2002/xforms">
 >  >
 >  >      <p:param type="output" name="instance" debug="true"/>
 >  >
 >  >     <p:processor name="oxf:sql">
 >  >          <p:input name="datasource" href="../datasource-sql.xml"/>
 >  >         <p:input name="config">
 >  >             <sql:config xmlns:sql="http://orbeon.org/oxf/xml/sql">
 >  >               <xforms:model>
 >  >                       <xforms:instance>
 >  >                          <form>
 >  >                             <action/>
 >  >                               <sql:connection>
 >  >                                     <sql:execute>
 >  >                                       <sql:update>commit</sql:update>
 >  >                                   </sql:execute>
 >  >                                   <sql:execute>
 >  >                                         <sql:query>select * from Meal
 >  >                                       </sql:query>
 >  >                                       <sql:results>
 >  >                                          <sql:row-results>
 >  >                                               <dataset>
 >  >
 > <sql:get-columns format="xml"/>
 >  >                                               </dataset>
 >  >                                          </sql:row-results>
 >  >                                               </sql:results>
 >  >                                  </sql:execute>
 >  >                               </sql:connection>
 >  >                          </form>
 >  >                       </xforms:instance>
 >  >               </xforms:model>
 >  >               </sql:config>
 >  >         </p:input>
 >  >         <p:output name="data" ref="instance"/>
 >  >     </p:processor>
 >  > </p:config>
 >  >
 >  >
 >  > My PFC looks as follows:
 >  >
 >  >     <page id="FoodManager"  path-info="/FridaySnack/FoodManager"
 >  >
 > xforms="/FridaySnack/FoodManager/XFormsModel.xpl"
 >  >
 > view="/FridaySnack/FoodManager/view.xsl">
 >  > -Peter





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

Safari and DynamicXForms

Alexander Žaťko
In reply to this post by Erik Bruchez
None of the DynamicXForms examples seem to work with Safari 1.3. I
assume this is due to the fact that this browser (version) does not
have some technology essential for the demos to work?

thanks

Alex.




--
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: Safari and DynamicXForms

Erik Bruchez
Administrator
This is more because we haven't spent the time making the XForms engine
work with Safari and Opera. All the browsers are different as you know.

This said, support is planned for both those browsers, but there is no
ETA at this moment. If somebody wants to help...

-Erik

Alexander Zatko wrote:
> None of the DynamicXForms examples seem to work with Safari 1.3. I
> assume this is due to the fact that this browser (version) does not have
> some technology essential for the demos to work?
>
> thanks
>
> Alex.



--
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: Safari and DynamicXForms

Colin O'Brien
Hi Erik,

If I remember correctly, xmlhttprequest only came in with the recent
1.3 (runs on Panther 10.3.9) / 2.0 (runs on Tiger 10.4.x).
Anyway, if you google "safari xmlhttprequest" then you will find there
are still some deficiencies in their implementation.
Don't know if they will affect the AJAX libraries you are using, but
worth reading the first one at least ;-)

I know they've also been doing a lot of improvements on their
javascript support - hopefully all is good there for AJAX - though
might still mean we have to say Safari users have to get the latest
browser.
I'm still on 1.2.4 ;-) but I use Firefox almost as much.

Best regards
Colin

On Aug 5, 2005, at 1:27 PM, Erik Bruchez wrote:

> This is more because we haven't spent the time making the XForms
> engine work with Safari and Opera. All the browsers are different as
> you know.
>
> This said, support is planned for both those browsers, but there is no
> ETA at this moment. If somebody wants to help...
>
> -Erik
>
> Alexander Zatko wrote:
>> None of the DynamicXForms examples seem to work with Safari 1.3. I
>> assume this is due to the fact that this browser (version) does not
>> have some technology essential for the demos to work?
>> thanks
>> Alex.
>
>
> --
> 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



--
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: Safari and DynamicXForms

Erik Bruchez
Administrator
Thanks for the information! It looks like people are doing Ajax with
Safari (Goole Maps, for example), so there is definitely a way, even if
it may not be straightforward with pre-1.3.

-Erik

Colin O'Brien wrote:

> Hi Erik,
>
> If I remember correctly, xmlhttprequest only came in with the recent 1.3
> (runs on Panther 10.3.9) / 2.0 (runs on Tiger 10.4.x).
> Anyway, if you google "safari xmlhttprequest" then you will find there
> are still some deficiencies in their implementation.
> Don't know if they will affect the AJAX libraries you are using, but
> worth reading the first one at least ;-)
>
> I know they've also been doing a lot of improvements on their javascript
> support - hopefully all is good there for AJAX - though might still mean
> we have to say Safari users have to get the latest browser.
> I'm still on 1.2.4 ;-) but I use Firefox almost as much.
>
> Best regards
> Colin
>
> On Aug 5, 2005, at 1:27 PM, Erik Bruchez wrote:
>
>> This is more because we haven't spent the time making the XForms
>> engine work with Safari and Opera. All the browsers are different as
>> you know.
>>
>> This said, support is planned for both those browsers, but there is no
>> ETA at this moment. If somebody wants to help...
>>
>> -Erik
>>
>> Alexander Zatko wrote:
>>
>>> None of the DynamicXForms examples seem to work with Safari 1.3. I
>>> assume this is due to the fact that this browser (version) does not
>>> have some technology essential for the demos to work?
>>> thanks
>>> Alex.
>>
>>
>>
>> --
>> 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
>
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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



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