BaseX

How to configure a “hello world” HTML page using BaseX with RestXQ?

人盡茶涼 提交于 2021-01-29 16:42:53
问题 More of a usage question than a programming question, in relation to: BaseX RESTXQ "hello world" example How do I use RESTXQ with BaseX for a simple web app? basex/rest - blog complete app Is there a way to make BaseX serve an HTML document? Certainly, it's easy enough to fork the blog app. However, it's also eight years old. The sample from the documentation is: module namespace page = 'http://basex.org/examples/web-page'; declare %rest:path("hello/{$who}") %rest:GET function page:hello($who

how to count the number of elements in XML?

泄露秘密 提交于 2021-01-29 15:12:12
问题 I'm looking to get basic metadata about the data within a database. Specifically, the number of line elements which are surrouned by the root text element. Analogous to what I'd expect COUNT to return in SQL -- a single integer. the database: thufir@dur:~/flwor/group$ thufir@dur:~/flwor/group$ basex BaseX 9.0.1 [Standalone] Try 'help' to get more information. > > open people Database 'people' was opened in 225.24 ms. > > xquery / <text> <line>people</line> <line>joe</line> <line>phone1</line>

How to parse JSON from a file with BaseX?

穿精又带淫゛_ 提交于 2021-01-29 09:43:26
问题 Writing a JSONObject to file file from Twitter4J seems to work, at least the file looks correct when opened manually: public void writeJsonToFile(String fileName) throws FileNotFoundException, UnsupportedEncodingException, IOException { FileOutputStream fileOutputStream = null; OutputStreamWriter outputStreamWriter = null; BufferedWriter bufferedWriter = null; fileOutputStream = new FileOutputStream(fileName); outputStreamWriter = new OutputStreamWriter(fileOutputStream, "UTF-8");

How to set the serialization parameters for exporting data with BaseX?

落花浮王杯 提交于 2021-01-29 09:25:28
问题 How can I export what originated as a JSONArray object into a valid JSON file? It seems to be a matter of setting some export options. exporting the data file as XML : thufir@dur:~/flwor/foo$ thufir@dur:~/flwor/foo$ basex BaseX 9.0.1 [Standalone] Try 'help' to get more information. > > open foo_json Database 'foo_json' was opened in 383.76 ms. > > set parser json PARSER: json > > export /home/thufir/flwor/foo Database 'foo_json' was exported in 16.11 ms. > > exit Enjoy life. thufir@dur:~

BaseX error: No namespace declared for 'doc:csv'

两盒软妹~` 提交于 2021-01-07 01:35:31
问题 Referencing the csv module, how is the following data downloaded? nicholas@mordor:~/flwor/covid$ nicholas@mordor:~/flwor/covid$ basex uri.xq Stopped at /home/nicholas/flwor/covid/uri.xq, 3/13: [XPST0081] No namespace declared for 'doc:csv'. nicholas@mordor:~/flwor/covid$ nicholas@mordor:~/flwor/covid$ cat uri.xq xquery version "3.1"; let $csv := doc:csv('http://www.bccdc.ca/Health-Info-Site/Documents/BCCDC_COVID19_Dashboard_Lab_Information.csv') as $data return $data nicholas@mordor:~/flwor

BaseX error: No namespace declared for 'doc:csv'

▼魔方 西西 提交于 2021-01-07 01:35:29
问题 Referencing the csv module, how is the following data downloaded? nicholas@mordor:~/flwor/covid$ nicholas@mordor:~/flwor/covid$ basex uri.xq Stopped at /home/nicholas/flwor/covid/uri.xq, 3/13: [XPST0081] No namespace declared for 'doc:csv'. nicholas@mordor:~/flwor/covid$ nicholas@mordor:~/flwor/covid$ cat uri.xq xquery version "3.1"; let $csv := doc:csv('http://www.bccdc.ca/Health-Info-Site/Documents/BCCDC_COVID19_Dashboard_Lab_Information.csv') as $data return $data nicholas@mordor:~/flwor

XQuery in BaseX - let statement outside of file:write()

走远了吗. 提交于 2021-01-03 06:41:10
问题 I have the following code: let $fName := "C:\Users\user\Documents\Sitemaps\Updated Pages\Books.xml" file:write($fName, element titles{ for $x in doc("http://www.w3schools.com/xsl/books.xml")/bookstore/book where $x/price>0 order by $x/title return $x/title }) BaseX is giving me an error - "Incomplete FLWOR expression: expecting 'return'." It is specifically highlighting the file:write line, underlining file in red. I'm not sure why this is happening. How do I structure this to avoid syntax

XQuery in BaseX - let statement outside of file:write()

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-03 06:40:26
问题 I have the following code: let $fName := "C:\Users\user\Documents\Sitemaps\Updated Pages\Books.xml" file:write($fName, element titles{ for $x in doc("http://www.w3schools.com/xsl/books.xml")/bookstore/book where $x/price>0 order by $x/title return $x/title }) BaseX is giving me an error - "Incomplete FLWOR expression: expecting 'return'." It is specifically highlighting the file:write line, underlining file in red. I'm not sure why this is happening. How do I structure this to avoid syntax

Reading Multiple XML Files with BaseX

最后都变了- 提交于 2021-01-03 03:59:22
问题 Hi I am new to BaseX and I am trying to read a bunch of XML files from a folder. After reading those files I will output the data into the database table (some RDBMS). But I am lost as to where to start as I am not able to find much tutorials about working with BaseX. I had searched on internet but still not much help. Can someone please help me with this. Thanks in advance. 回答1: Use CREATE DB yourdbname /path/to/folder to create a database containing all documents in this folder. To access

Reading Multiple XML Files with BaseX

给你一囗甜甜゛ 提交于 2021-01-03 03:57:05
问题 Hi I am new to BaseX and I am trying to read a bunch of XML files from a folder. After reading those files I will output the data into the database table (some RDBMS). But I am lost as to where to start as I am not able to find much tutorials about working with BaseX. I had searched on internet but still not much help. Can someone please help me with this. Thanks in advance. 回答1: Use CREATE DB yourdbname /path/to/folder to create a database containing all documents in this folder. To access