Quantcast

how can i give dynamic input xml file name to my xforms.?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

how can i give dynamic input xml file name to my xforms.?

Kiran Kumar
Hello,

I am able to load and save the xml using xforms, like below

<xf:instance id="order-instance" src="oxf:/apps/customer-order/model.xml" xmlns="">
                        </xf:instance> 
                       
<xf:submission id="load-data" serialization="none"
                       method="get" action="file:///D:/kiran/resources.xml"
                       replace="instance" instance="order-instance"/>
<xf:submission id="save-submission" ref="instance('order-instance')"
                    action="/customer-order/write"
                    method="post" instance="order-instance" replace="none">
                <xf:message ev:event="xforms-submit-error" level="modal">An error occurred while saving...!</xf:message>
               <center> <xf:message type="text-align: center;" ev:event="xforms-submit-done">Successfully Done...!</xf:message></center>
        </xf:submission> 

.Xpl is

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
          xmlns:oxf="http://www.orbeon.com/oxf/processors">
    <p:param name="instance" type="input"/>
   

    <p:processor name="oxf:xml-converter"> 
            <p:input name="config"> 
                <config> 
                    <encoding>utf-8</encoding> 
                </config> 
            </p:input> 
            <p:input name="data" href="#instance"/> 
            <p:output name="data" id="converted"/> 
        </p:processor> 

        <p:processor name="oxf:file-serializer"> 
            <p:input name="config"> 
                <config> 
                    <content-type>text/xml</content-type> 
                    <directory>D:/temp</directory> 
                    <file>test.xml</file> 
                </config> 
            </p:input> 
            <p:input name="data" href="#converted"/> 
           
        </p:processor>     
</p:config> 



Here my input xml file name is resources.xml  and saving xml file name is test.xml , now how can i pass that names as dynamic.

my url have parameters like http://localhost:1010/orbeon/customer-order/?i_name=aaa.xml&o_name=bbb.xml.


Thanks,
kiran.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how can i give dynamic input xml file name to my xforms.?

Kiran Kumar
Hi ,

A small change, i want to pass whole path like D:/kiran/resources.xml(i can send this through url as a variable ) to my form to view the details at run time and i have to save the file like resources_---_----.xml(same name of input xml file with some date,time extension attach)

Here i am unable to take the same input file name to .xlp file but i can add date, time as extension using link below
 http://discuss.orbeon.com/Dynamic-file-name-in-file-serializer-tc36159.html#a36166

please help me...!

Thanks,
Kiran.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how can i give dynamic input xml file name to my xforms.?

Alessandro  Vernet
Administrator
Hi Kiran,

You can make the file name dynamic (instead of having it always be test.xml), by producing the `config` input of the `oxf:xml-converter` using XSLT. You can search for uses of `oxf:xslt` in the code to find examples of XSLT being used to produce documents in XPL.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how can i give dynamic input xml file name to my xforms.?

Kiran Kumar
Hi Alessandro,

Yes i did that.

How can i pass the input file name(which xml file i have to render into a form) from my jsp file to xhtml file at run time.


Thanks for you reply,


Thanks
Kiran.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how can i give dynamic input xml file name to my xforms.?

Kiran Kumar
Hi,

I am able to send an instance(<books><book>1</book></books> or a path(d:/kiran/sample.xml)
from a jsp page to respected jsp(xhtml) but how can i populate that instance or a path into jsp(xhtml) model->instance tag. I tried like below,
 <xf:model  >
                       
                        <xf:instance id="order-instance"  >       
                                <%=request.getParameter("xml")%>
                        </xf:instance> 
------
</xf:model>
or
 <xf:model  >
                       
                        <xf:instance id="order-instance"  >       
                                <xf:include src="file:///<%=request.getParameter("path")%">         
                        </xf:instance> 
------
</xf:model>


Please give me a model how to do..?

Thanks,
Kiran

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how can i give dynamic input xml file name to my xforms.?

Alessandro  Vernet
Administrator
Hi Kiran,

You have a request parameter that contains the path of a file on disk? If that's the case, it seems *highly* insecure, as this would allow users to access data in other files!

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how can i give dynamic input xml file name to my xforms.?

Kiran Kumar
Hi Alessandro,

Thanks for your reply.

But that is the requirement i have to do.


Please help me how to do.


Thanks,
Kiran.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how can i give dynamic input xml file name to my xforms.?

Kiran Kumar
In reply to this post by Alessandro Vernet
Hi Alessandro,

I am able to pass the instance (xml data as a String data)  and path (D:/kiran/sample.xml) through the parameters but which is in hidden.

I don't know how to get this instance or path into a jsp(xhtml) file.

please let me know which way is good, and how to do that.



Thanks,
Kiran

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how can i give dynamic input xml file name to my xforms.?

Kiran Kumar
In reply to this post by Alessandro Vernet

Hi  Alessandro,
 
In my Request object one of a parameter having xml data as a string so how can i pass that xml data as a instance into my jsp(xhtml)

(say xml data is  : String data="<books><book><name>AAA</name><author>BBB</author></book> </books>";  )
                           
       
I did like below :

<xf:model  >
                <xf:instance id="order-instance" >       
                        <%= request.getParameter("data") %>
               </xf:instance> 
---------------
---------------
</xf:model>

It is not working,Please help me how can i gat instance into my jsp(hhtml) from a request parameter.

Thanks,
Kiran.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how can i give dynamic input xml file name to my xforms.?

Alessandro  Vernet
Administrator
In reply to this post by Kiran Kumar
Hi Kiran,

I'm afraid that the time we have available to answer questions on this community forum is limited, and prefer not to spend it on helping people using the product in a way we wish to discourage. If you're using Orbeon Forms PE, I'd recommend you contact us through your normal support channel, and we should be able to help.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Loading...