Suggestion about the tutorial examples

Saturday, 9 October 2010 · 2 messages
R
ramon9 Oct 2010 19:39 #
(Newbie alert) I just discovered BaseX. Congratulations and big thanks to the authors and all involved! I have been investigating a LOT of alternatives (programming languages, OSs, toolkits, etc.) and have concluded that the best approach for my application (XML read-only) is to use XPath (plus some XQuery). I have found some introductory examples written in C++ (Xerces) where the authors go through all kinds of complex convolutions to redirect the result of the XPath query to the screen. I hate to state the obvious, but we newbies do not want to send the XML elements to the screen. We rather assign them to some variable. That is the request I have. I think the application "QueryExample" and similar could use some way to assign the retrieved values to a variable. Thanks again! -Ramon (I am not in this mailing list)
CG
Christian Grün9 Oct 2010 21:27 #
Hi Ramon,
Quoted text · ramon · 3 lines
> I hate to state the obvious, but we newbies do not want to send the XML elements to the screen. We rather assign them to some variable. > > That is the request I have. I think the application "QueryExample" and similar could use some way to assign the retrieved values to a variable.
Sure, that's comprehensible. If you are using a more recent version of BaseX, such as.. http://www.inf.uni-konstanz.de/dbis/basex/maven/org/basex/basex/6.2.9/basex-6.2.9.jar you can modify the quoted QueryExample and use the following simple line of code to assign the string result of a query to a variable: String result = new XQuery(query).execute(context); The official examples will all be updated with the next official release. Christian

⚡Generated with XQuery