Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Edited question - putting everything into an actual Zorba collection as opposed to a nodelist. You might want to choose between static and dynamic collections for your purposes.</p> <p><strong>F.xq:</strong></p> <pre><code>module namespace X = "urn:xml-files"; import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl"; import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml"; import module namespace file = "http://expath.org/ns/file"; import module namespace x = "http://www.zorba-xquery.com/modules/xml"; declare namespace ann = "http://www.zorba-xquery.com/annotations"; declare collection X:files as node()*; declare variable $X:uri := xs:QName('X:files'); declare %ann:nondeterministic function X:get-xml-list($dir-name as xs:string) { let $files := file:list($dir-name, true()) for $filename in $files where ends-with($filename, ".xml") return $filename }; declare %ann:sequential function X:load-files($names as xs:string*) { ddl:create($X:uri); dml:insert-nodes($X:uri, for $filename in $names return x:parse(file:read-text($filename),())); }; declare %ann:sequential function X:load-directory($dir-name as xs:string) { X:load-files(X:get-xml-list($dir-name)) }; </code></pre> <p><strong>x.xq:</strong></p> <pre><code>xquery version "3.0" encoding "utf-8"; import module namespace X = "urn:xml-files" at "F.xq"; import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml"; X:load-directory("C:\Projects-dir...-with-xmls\"); dml:collection($X:uri) </code></pre> <p>References:</p> <ul> <li><a href="http://www.zorba.io/documentation/2.9/zorba/xqddf.html" rel="nofollow noreferrer">http://www.zorba.io/documentation/2.9/zorba/xqddf.html</a></li> <li><a href="http://en.wikipedia.org/wiki/Zorba_(XQuery_processor)" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Zorba_(XQuery_processor)</a></li> <li><a href="http://www.w3.org/TR/xpath-functions-30/#func-ends-with" rel="nofollow noreferrer">http://www.w3.org/TR/xpath-functions-30/#func-ends-with</a></li> <li><a href="http://www.zorba.io/documentation/2.9/modules/expath.org_ns_file.html" rel="nofollow noreferrer">http://www.zorba.io/documentation/2.9/modules/expath.org_ns_file.html</a></li> <li><a href="https://stackoverflow.com/questions/13026559/create-collection-add-document-to-zorba-using-command-line">create collection, add document to zorba using command line?</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload