collection read from xpl

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

collection read from xpl

rameshkancherla
Hi,

      I am implementing xpl in my application. in events collection there are  multiple event.xml files. in each xml file there is a tag called <eventname>.

     I have to read that events collection and xml files and  then return event names to xform.

I am new to xpl

can any one please give me suggestion how to do it

Thanks & Regards
Ramesh

Reply | Threaded
Open this post in threaded view
|

Re: collection read from xpl

fl.schmitt(ops-users)
Ramesh,

>
>       I am implementing xpl in my application. in events collection there
> are  multiple event.xml files. in each xml file there is a tag called
> <eventname>.
>
>      I have to read that events collection and xml files and  then return
> event names to xform.
>
> I am new to xpl
>
> can any one please give me suggestion how to do it
there's an example in the documentation:

http://www.orbeon.com/ops/doc/processors-xmldb#xmldb

The example for the xmldb-query processor shows how to query a xml
database - you just have to change the path and the xquery. It could
look as follows:

xquery version "1.0";
<events>
{ for $d in /db/events//eventname return $d }
</events>

You should optimize the xpath according to your db structure.

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
Reply | Threaded
Open this post in threaded view
|

Re: collection read from xpl

rameshkancherla
Hi,

    I am getting empty root when returning xpl.

in event.xml contains  like

<event>
<name>test-event1</name>
</event>

these xml files are in events collection

I have used query in xpl as

         <events>
         { for $d in /db/events//name return $d }
         </events>

then i am getting <events/> tag only.


can you please give me suggestion

Thanks & Regards
Ramesh





fs(ops-users) wrote
Ramesh,

>
>       I am implementing xpl in my application. in events collection there
> are  multiple event.xml files. in each xml file there is a tag called
> <eventname>.
>
>      I have to read that events collection and xml files and  then return
> event names to xform.
>
> I am new to xpl
>
> can any one please give me suggestion how to do it

there's an example in the documentation:

http://www.orbeon.com/ops/doc/processors-xmldb#xmldb

The example for the xmldb-query processor shows how to query a xml
database - you just have to change the path and the xquery. It could
look as follows:

xquery version "1.0";
<events>
{ for $d in /db/events//eventname return $d }
</events>

You should optimize the xpath according to your db structure.

hth
florian


--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: collection read from xpl

fl.schmitt(ops-users)
Hi Ramesh,

> I have used query in xpl as
>
>          <events>
>          { for $d in /db/events//name return $d }
>          </events>
>
> then i am getting <events/> tag only.

the exact XPath depends completely on the structure of your database, so
i can't formulate the Xpath precisely. Besides that, you can name a
certain collection in the xdb:query element (see the example in the
docs), maybe that collection is wrong.

In my app, i usually address the resources using the collection() function:

collection('/db/<sub-path>')/...

So, you could try

collection('/db/events')/event/name

to address the name elements, if this matches your db structure.

I recommend to test the xquery separately using the eXist java client or
the eXist XQuery sandbox first before putting it into an XPL. It's much
easier to debug the xquery using one of those tools, and only if the
query is working as expected, it should be included in a XPL.


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