
infodev:filesystem-walk( $dir-path as xs:string, $ticket-id as xs:string, $function as xdmp:function, $policy-deltas as element(info:options)?, [$context as item()?] ) as empty-sequence()
[DEPRECATED] This function can be used along with the infodev:ingest function to
build custom load operations.
infodev:ingest function to load them into the
database.
xquery version "1.0-ml";
import module namespace info = "http://marklogic.com/appservices/infostudio"
at "/MarkLogic/appservices/infostudio/info.xqy";
import module namespace infodev = "http://marklogic.com/appservices/infostudio/dev"
at "/MarkLogic/appservices/infostudio/infodev.xqy";
declare function local:process-file(
$document as node()?,
$source-location as xs:string,
$ticket-id as xs:string,
$policy-deltas as element(info:options)?,
$context as item()?)
{
(: You can modify the file here :)
infodev:ingest($document, $source-location, $ticket-id)
};
let $function := xdmp:function(xs:QName("local:process-file"))
let $annotation := <info:annotation>Loading XML docs</info:annotation>
let $dir-path := "C:\mydocs\xmldocs"
let $ticket := infodev:ticket-create(
$annotation,
"myDB",
(),
() )
return infodev:filesystem-walk(
$dir-path,
$ticket,
$function,
(),
() )
(: This query does the same thing as the info:load function. You can write the
process-file function to modify each file in some manner before calling
the infodev:ingest function. :)
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.