Hi All,
I my application a folder is getting created at runtime, and it stores various image files. I need to get a list of those file names and show them in a drop down combo box. Which are the processors which would help me in traversing through a folder and getting the list of files? Please help!!! |
hi adev,
> I my application a folder is getting created at runtime, and it stores > various image files. > I need to get a list of those file names and show them in a drop down combo > box. > > Which are the processors which would help me in traversing through a folder > and getting the list of files? > Please help!!! There's a "directory scanner" that seems suitable for your task: http://www.orbeon.com/ops/doc/processors-directory-scanner HTH florian -- 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 |
Thanks Florian,
The Directory Scanner looks good. The output of the Directory Scanner is an XML Document with 'Directory' as the root node and subsequent 'file' nodes. I am looking forward to write an XPL which would populate an Instance with the file names in that directory Example (Instance) <xforms:instance id="filename-instance"> <files xmlns=""> <filename /> </files> </xforms:instance> <xforms:submission id="getfilename" ref="instance('filename-instance')" action="getFileList" method="post" replace="instance" instance="filename-instance"> </xforms:submission> Saving the output XML document and then parsing it to get the names would degrade the performance How can I get the output in the above explained format?
|
hi adev
> I am looking forward to write an XPL which would populate an Instance with > the file names in that directory > > Example > (Instance) > <xforms:instance id="filename-instance"> > <files xmlns=""> > <filename /> > </files> > </xforms:instance> > > > <xforms:submission id="getfilename" ref="instance('filename-instance')" > action="getFileList" method="post" replace="instance" > instance="filename-instance"> > </xforms:submission> > > Saving the output XML document and then parsing it to get the names would > degrade the performance It may contain some data you won't need, but you save a little time and resources that would be consumed by an xslt transformation. If you use the directory scanner output unchanged, you could reference the filenames for example in a select1 comboBox as follows: <xforms:select1 ref="selected-file" appearance="minimal"> <xforms:itemset nodeset="instance('filename-instance')/file"> <xforms:label ref="@name"/> <xforms:value ref="@name"/> </xforms:itemset> </xforms:select1> > How can I get the output in the above explained format? You just have to combine the directory scanner with a xslt processor: http://www.orbeon.com/ops/doc/processors-xslt The XSLT could look as follows: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/directory"> <files> <xsl:apply-templates select="file" /> </files> </xsl:template> <xsl:template match="file"> <filename> <xsl:value-of select="@name" /> </filename> </xsl:template> </xsl:stylesheet> (this stylesheet ignores the files in subdirectories) To combine the directory scanner with the xslt processor, you could use something like: <p:processor name="oxf:pipeline"> <p:input name="config"> <config> <base-directory>file:/</base-directory> <include>**/*.jpg</include> <exclude>**/*.xml</exclude> <case-sensitive>false</case-sensitive> </config> <p:output name="data" id="directory" /> </p:processor> <p:processor name="oxf:xslt"> <p:input name="data" href="#directory" /> <p:input name="config" href="oxf:/xsl/dir2filelist.xsl" /> <p:output name="data" id="filelist" /> </p:processor> This way, the xslt processor loads an external xslt stylesheet to perform the transformation. You could put the transformation code inside the config input, too. To send the filelist back to the xforms, just add a xml serializer: http://www.orbeon.com/ops/doc/processors-serializers#xml-serializer that takes the xslt output: <p:processor name="oxf:xml-serializer"> <p:input name="config"> <config> <content-type>application/xml</content-type> </config> </p:input> <p:input name="data" href="#filelist"/> </p:processor> Connecting processor inputs and outputs is described here: http://www.orbeon.com/ops/doc/reference-xpl-pipelines#d48e1098 and the xpl in- and outputs: http://www.orbeon.com/ops/doc/reference-xpl-pipelines#param HTH florian -- 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 |
Administrator
|
In reply to this post by adev
We have the oxf:directory-scanner processor:
http://www.orbeon.com/ops/doc/processors-directory-scanner -Erik On Mar 13, 2008, at 12:02 AM, adev wrote: > > Hi All, > > I my application a folder is getting created at runtime, and it stores > various image files. > I need to get a list of those file names and show them in a drop > down combo > box. > > Which are the processors which would help me in traversing through a > folder > and getting the list of files? > Please help!!! 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |