xquery

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 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:~

How to use Select-Xml in Powershell to print the content of an xml node element?

…衆ロ難τιáo~ 提交于 2021-01-29 06:00:39
问题 restricted to xpath or even Select-Xml how else are the book titles printed? PS /home/nicholas/powershell> PS /home/nicholas/powershell> Select-Xml "./bookstore.xml" -XPath "/bookstore/book/title" | foreach {$_.node.InnerXML} Pride And Prejudice The Handmaid's Tale Emma Sense and Sensibility PS /home/nicholas/powershell> PS /home/nicholas/powershell> Select-Xml -Path "./bookstore.xml" cmdlet Select-Xml at command pipeline position 1 Supply values for the following parameters: XPath:

How to load or read an XML file using ConvertTo-Xml and Select-Xml?

让人想犯罪 __ 提交于 2021-01-12 06:11:39
问题 How can I accomplish something like this: PS /home/nicholas/powershell> PS /home/nicholas/powershell> $date=(Get-Date | ConvertTo-Xml) PS /home/nicholas/powershell> PS /home/nicholas/powershell> $date xml Objects --- ------- version="1.0" encoding="utf-8" Objects PS /home/nicholas/powershell> PS /home/nicholas/powershell> $date.OuterXml <?xml version="1.0" encoding="utf-8"?><Objects><Object Type="System.DateTime">12/12/2020 2:43:46 AM</Object></Objects> PS /home/nicholas/powershell> but,

how to use the cmdlet Select-Xml interactive prompt?

我是研究僧i 提交于 2021-01-07 02:53:38
问题 How is Select-Xml used as below: PS /home/nicholas/powershell> PS /home/nicholas/powershell> Select-Xml cmdlet Select-Xml at command pipeline position 1 Supply values for the following parameters: Xml[0]: ./bookstore.xml Xml[1]: XPath: /bookstore Select-Xml: Cannot bind parameter 'Xml'. Cannot convert the "./bookstore.xml" value of type "System.String" to type "System.Xml.XmlNode". PS /home/nicholas/powershell> by entering the parameters and Xpath through the REPL as above. Certainly: PS

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

How to parse a date and time (timestamp) to query for a range with XML?

放肆的年华 提交于 2020-12-27 07:13:42
问题 this is a start: > > XQUERY fn:parse-ietf-date('Tue, 18 Jun 2019 13:10:56 GMT') 2019-06-18T13:10:56Z Query executed in 425.5 ms. > from the basex console. need to apply to the query for a searchable date. see also: Inverse function to format-date Google chat, or "hangouts" exports its data as JSON. The dates are in UTC as a String, looking at least similar to: Thursday, 17-Dec-20 14:29:33 UTC in RFC 2822 https://www.unixtimestamp.com/ Assuming RFC 2822, or similar, then how would that String

In XML, is an atomic node the same thing as a leaf node?

南楼画角 提交于 2020-12-11 08:50:09
问题 I am working through a tutorial on the W3Schools website about XML. This is the page I'm on: http://www.w3schools.com/xsl/xquery_terms.asp I'm a bit confused about the difference between an atomic node and a leaf node. Are they the same thing? I know that a leaf node is a node without any children, but it also seems that the atomic nodes in the given example don't have any children either. The W3Schools site says "Atomic values are nodes with no children or parent." Surely it's impossible for