开发者

how to load multiple xml files with saxon

开发者 https://www.devze.com 2023-01-19 15:16 出处:网络
I want to use saxon for xpath queries but i don\'t know to load multiple xml fi开发者_如何学Goles.

I want to use saxon for xpath queries but i don't know to load multiple xml fi开发者_如何学Goles.

I'm trying to use saxon with command line from windows

I read in saxon manual that i can use the command:

Query.exe -s:myDataFile.xml -q:myQueryFile -o:myOutputFile

but i don't know how to load multiple xml files and not just one

edit: I have many xml files myDataFile1.xml, myDataFile2.xml, myDataFile3.xml ... and i want to run the query to alla these files So i want to load all all files and then query them (I don't want to query every single file and then concatenate the results)


Use the standard XPath 2.0 function collection().

The documentation for the Saxon-specific implementation of collection() is here.

You can use the standard XPath 2.x collection() function, as implemented in Saxon 9.x

The Saxon implementation allows a search pattern to be used in the string-Uri argument of the function, thus you may be able to specify after the path of the directory a pattern for any filename starting with report_ then having two other characters, then ending with .xml.

Example:

This XPath expression:

collection('file:///c:/?select=report_*.xml')

selects the document nodes of every XML document that resides in c:\ in a file with name starting with report_ then having a 0 or more characters, then ending with .xml.

0

精彩评论

暂无评论...
验证码 换一张
取 消