BaseX

Xquery group by on 2 tags

家住魔仙堡 提交于 2020-01-03 18:02:46
问题 Below is the XML part of my data. <A> <a><Type>Fruit</Type><Name>Banana</Name></a> <a><Type>Fruit</Type><Name>Orange</Name></a> <a><Type>Fruit</Type><Name>Apple</Name></a> <a><Type>Fruit</Type><Name>Lemon</Name></a> <a><Type>Cars</Type><Name>Toyota</Name></a> <a><Type>Cars</Type><Name>Lamborghini</Name></a> <a><Type>Cars</Type><Name>Renault</Name></a> </A> Out put as - <a>Fruits-Banana,Orange,Apple,Lemon</a> <a>Cars-Toyota,Lamborghini,Renault</a> I tried to get the required output by all in

Insertion of an data in an XML using Basex

我的梦境 提交于 2020-01-02 03:40:08
问题 I am storing two XML documents, namely hospital and office, in BaseX. The following is the office xml: <Staff> <Employee Name="Brian"> <Personal> <SSN> 666-66-6666 </SSN> </Personal> <StaffInfo> <Position> Doctor </Position> <AccountableTo> David </AccountableTo> </StaffInfo> </Employee> <Employee Name="David"> <Personal> <SSN> 555-55-5555 </SSN> </Personal> <StaffInfo> <Position> Doctor </Position> <AccountableTo /> </StaffInfo> </Employee> </Staff> In this XML I want to add one or more

Is it possible to retrieve the namespace of a raised error?

╄→尐↘猪︶ㄣ 提交于 2019-12-25 08:57:40
问题 When I raise an error from within an XQuery query, for instance with: error( fn:QName( 'http://example.com', 'XMPL0001' ), 'Conflict' ) ... the following is returned by BaseX (be it when communicating with the server, or from within the GUI) Stopped at ., 1/7: [XMPL0001] Conflict Is it somehow possible to retrieve the namespace of the error (in this case http://example.com ) as well? I'm using a customized PHP client and I would like to use this information to prevent possible (future)

BaseX: Slow XQuery

≯℡__Kan透↙ 提交于 2019-12-25 03:24:26
问题 I've got a BaseX XML database with ~20 XML files. These files are different in size and structure. The biggest file has got 524 MB. It consists of a parent ARTICLE tag with 267685 ART subtags. This is my XQuery: "/ARTICLE/ART[PRDNO=12345]" (pretty straightforward; proper namespaces omitted for clarity). PRDNO is a foreign key to the PRODUCT/PRD XML structure, there are multiple (in average ~10) products per article. Everything works as it is supposed to, but this query is quite slow - it

how to wrap xquery results in elements?

吃可爱长大的小学妹 提交于 2019-12-24 19:42:59
问题 How do I wrap each result in a <book_result> element? the xquery itself: <new_cat>{ for $x in catalog/book order by $x/title return ($x/title, $x/author) }</new_cat> which runs fine, but the title and author aren't wrapped in a new book: thufir@dur:~/basex/microsoft$ thufir@dur:~/basex/microsoft$ basex -i w3school_data title_author.xq <new_cat> <title>Creepy Crawlies</title> <author>Knorr, Stefan</author> <title>Lover Birds</title> <author>Randall, Cynthia</author> <title>MSXML3: A

how to extract an XPATH from an html page with BaseX commandline

不问归期 提交于 2019-12-24 10:46:13
问题 I would like to extract the XPATH //DIV[@id="ps-content"] out from this web page: http://www.amazon.com/dp/1449319432 (saved as a local file) I would like to do it with a single line of command-line with one of the best parsers, like BaseX or Saxon-PE. So far the shortest solution that I (seemed to have) found is with these two lines: java -jar tagsoup-1.2.1.jar <page.html >page.xhtml" basex -ipage.xhtml "//DIV[@id='ps-content']" but all what it returns is an empty line, instead than my

Execute XQuery with BaseX

喜欢而已 提交于 2019-12-22 00:02:13
问题 I am trying to use BaseX to run an XQuery with no success. I have tried typing commands like: doc("Bookstore.xml")//Bookstore //Bookstore XQUERY[//Bookstore] and i am getting these error messages: Stopped at C:/tools/libxml/file, 1/32: Unknown command: doc("Bookstore.xml")//Bookstore. Try HELP. Stopped at C:/tools/libxml/file, 1/12: Unknown command: //Bookstore. Try HELP. Stopped at C:/tools/libxml/file, 1/20: Unknown command: XQUERY[//Bookstore]. Try HELP. whenever i try to hit Execute Query

How to return results together with update operations in BaseX?

血红的双手。 提交于 2019-12-20 03:52:07
问题 I recognized that ( insert / delete )-XQueries executed with the BaseX client always returning an empty string. I find this very confusing or unintuitive. Is there a way to find out if the query was "successful" without querying the database again (and using potentially buggy "transitive" logic like "if I deleted a node, there must be 'oldNodeCount-1' nodes in the XML")? 回答1: XQuery Update statements do not return anything -- that's how they are defined. But you're not the only one who does

Can I make XQuery evaluate { $expression } within variables bound with XQJ?

主宰稳场 提交于 2019-12-13 02:19:20
问题 To mimic an auto-increment value in XQuery Update, the following works fine, assuming <root count="0"/> when running this for the first time: let $count := /root/@count return ( insert node <node id='{ $count }'/> into /root, replace value of node $count with $count + 1 ) ...nicely yielding: <root count="1"> <node id="0"> </root> However, I'd like to define the node in my Java code, and then bind that as an org.w3c.dom.Node or Document , or even String . Like: String expr = " declare variable

BaseX Database Add in Java

前提是你 提交于 2019-12-12 03:04:25
问题 I am quite new to developing using the BaseX api, and I keep running into some trouble with one of the methods. I have a database created and opened, but when I try to use the Add method it throws an exception. See this page for an example from BaseX. I have created the Database in another section of the code, and the file I am trying to add also exists on my computer. My snippet of code looks like this: //Opens the database new Open(databaseName).execute(context); //adds file to database new