xquery version '1.0';
declare namespace xmldb = 'http://exist-db.org/xquery/xmldb';
declare namespace util = 'http://exist-db.org/xquery/util';
(: parameters :)
let $collection-name :=
'/db'
let $username :=
''
let $password :=
''
(: log in using the login information :)
let $authentication :=
xmldb:authenticate($collection-name, $username, $password)
(: return a collection tag with embedded collection and resource tags :)
return
{
for $x in xmldb:get-child-collections($collection-name)
order by $x
return ,
for $x in xmldb:get-child-resources($collection-name)
where ($x != 'collection.xconf')
order by$x
return
}
(: retreive a handle to the requested collection :)
let $collection :=
xmldb:collection($collection-name, $username, $password)
(: return a collection tag with embedded collection and resource tags :)
return
{
for $x in xmldb:get-child-collections($collection)
order by $x
return ,
for $x in xmldb:get-child-resources($collection)
where ($x != 'collection.xconf')
order by$x
return
}