eXist builtin functions - atomic.exist-db.org/xquery/cleanup

xquery version "3.0";
(:~
 : eXist-db cleanup function
 :
 : @see http://exist-db.org/exist/apps/fundocs/view.html?uri=http://atomic.exist-db.org/xquery/cleanup&location=/db/apps/wiki/modules/cleanup.xql&details=true
 :
 :)
module namespace cleanup ="http://atomic.exist-db.org/xquery/cleanup";

declare namespace a = "http://reecedunn.co.uk/xquery/annotations";
declare namespace o = "http://reecedunn.co.uk/xquery/options";

declare %a:since("exist", "4.4") function cleanup:clean($nodes as node()*) as item()* external;


Changed feed.xql to use fn:doc instead of httpclient for downloading the atom news feed. httpclient doesn't work with cocoon due to version conflict.

svn path=/trunk/eXist/; revision=7226

xquery version "1.0";

declare namespace atom="http://www.w3.org/2005/Atom";

declare variable $atom:server := "http://atomic.exist-db.org";
declare variable $atom:uri := concat($atom:server, "/atom/summary/wiki/blogs/eXist/");

declare function atom:format-entry($feed as element()) {

    {
        for $entry in $feed//atom:entry
        let $link := $entry/atom:link[@rel = 'alternate'][@type = 'text/html']/@href
        return

                    {substring($entry/atom:published, 1, 10)}

                    {$entry/atom:title/text()}

    }

};

let $uri := xs:anyURI($atom:uri)
let $response := doc($uri)
return
    atom:format-entry($response/atom:feed)

xquery version "1.0";

declare namespace atom="http://www.w3.org/2005/Atom";

import module namespace httpclient="http://exist-db.org/xquery/httpclient"
    at "java:org.exist.xquery.modules.httpclient.HTTPClientModule";
import module namespace json="http://www.json.org" at "resource:org/exist/xquery/lib/json.xq";

declare variable $atom:server := "http://atomic.exist-db.org";
declare variable $atom:uri := concat($atom:server, "/atom/summary/wiki/blogs/eXist/");

declare function atom:format-entry($feed as element()) {

    {
        for $entry in $feed//atom:entry
        let $link := $entry/atom:link[@rel = 'alternate'][@type = 'text/html']/@href
        return

                    {substring($entry/atom:published, 1, 10)}

                    {$entry/atom:title/text()}

    }

};

let $uri := xs:anyURI($atom:uri)
let $response := httpclient:get($uri, false(), ())
return
    atom:format-entry($response/httpclient:body/atom:feed)