xquery

Is there any possibility to generate random numbers using XQuery? [closed]

Deadly 提交于 2019-12-22 09:40:08
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I have to generate a series of random numbers using XQuery.I found a set of libraries but those are paid.If anyone can give me a direction it would be much appreciated(preferably code). 回答1: The standard XQuery

Select text from a node and omit child nodes

元气小坏坏 提交于 2019-12-22 05:35:31
问题 I need to select the text in a node, but not any child nodes. the xml looks like this <a> apples <b><c/></b> pears </a> If I select a/text() , all I get is " apples ". How would I retreive " apples pears " while omitting <b><c/></b> 回答1: Well the path a/text() selects all text child nodes of the a element so the path is correct in my view. Only if you use that path with e.g. XSLT 1.0 and <xsl:value-of select="a/text()"/> it will output the string value of the first selected node. In XPath 2.0

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 convert nested hierarchy of xml to sql table

若如初见. 提交于 2019-12-21 20:52:14
问题 Using MSSQL 2008 and XQUERY Consider the following XML stored in a table: <ROOT> <WrapperElement> <ParentElement ID=1> <Title>parent1</Title> <Description /> <ChildElement ID="6"> <Title>Child 4</Title> <Description /> <StartDate>2010-01-25T00:00:00</StartDate> <EndDate>2010-01-25T00:00:00</EndDate> </ChildElement> <ChildElement ID="0"> <Title>Child1</Title> <Description /> <StartDate>2010-01-25T00:00:00</StartDate> <EndDate>2010-01-25T00:00:00</EndDate> </ChildElement> <ChildElement ID="8">

xquery to convert attributes to tags

不羁的心 提交于 2019-12-21 20:48:35
问题 I am learning on Xquery. I have this tag in my XML document. <element a="1" b="2" c="3" name="testgroupID">198</element> <element a="11" b="12" c="13" name="testgroupverifyID" binary="hidden"/> May I know how to create something like the following with xquery? <mytags> <a>1</a> <b>2</b> <c>3</c> <name>testgroupID</name> <value>198</value> </mytags> <mytags> <a>11</a> <b>12</b> <c>13</c> <name>testgroupverifyID</name> <binary>hidden</binary> </mytags> Currently I could only use the static way

Screen scraping: regular expressions or XQuery expressions?

与世无争的帅哥 提交于 2019-12-21 13:16:03
问题 I was answering some quiz questions for an interview, and the question was about how would I do screen scraping. That is, picking content out of a web page, assuming you don't have a better structured way to query the information directly (e.g. a web service). My solution was to use an XQuery expression. The expression was fairly long because the content I needed was pretty deep in the HTML hierarchy. I had to search up through the ancestors a fair way before I found an element with an id

how to use if else in xquery assignment

江枫思渺然 提交于 2019-12-21 07:02:27
问题 I am trying to use a if condition to assign a value to a variable in an xquery. I am not sure how to do this. This is what I tried: declare namespace libx='http://libx.org/xml/libx2'; declare namespace atom='http://www.w3.org/2005/Atom'; declare variable $entry_type as xs:string external; let $libx_node := if ($entry_type = 'package' or 'libapp') then {element {fn:concat("libx:", $entry_type)} {()} } else if ($entry_type = 'module') then '<libx:module> <libx:body>{$module_body}</libx:body> <

How to retrieve parent node using XQuery?

夙愿已清 提交于 2019-12-21 03:13:24
问题 I am using XML and XQuerie. I usually use an XPath expression relative to a parent node to retrieve its child node. But, I am not sure how to do the opposite meaning if I have a child node, how do I retrieve its parent node. <node id="50> <childnode1 childid="51" /> <childnode2 childid="52" /> </node> If I have the node <childnode1 childid="51" /> , how do I retrieve its parent: <node id="50> 回答1: Short answer : .. This selects the parent of the current (context) node. Longer and more general

How to retrieve parent node using XQuery?

不羁岁月 提交于 2019-12-21 03:13:07
问题 I am using XML and XQuerie. I usually use an XPath expression relative to a parent node to retrieve its child node. But, I am not sure how to do the opposite meaning if I have a child node, how do I retrieve its parent node. <node id="50> <childnode1 childid="51" /> <childnode2 childid="52" /> </node> If I have the node <childnode1 childid="51" /> , how do I retrieve its parent: <node id="50> 回答1: Short answer : .. This selects the parent of the current (context) node. Longer and more general

Is there any way in XQuery to get the current time in milliseconds since some Epoch?

与世无争的帅哥 提交于 2019-12-20 10:37:33
问题 XQuery offers various date/time functions like current-dateTime() , however I can't seem to find one which gives me the time in milliseconds since Epoch. Functions to extract hours, minutes and seconds seem to exist too individually. What is the right way to get the Epoch time (i.e. unix time or similar) in XQuery ? 回答1: (current-dateTime() - xs:dateTime("1970-01-01T00:00:00-00:00")) div xs:dayTimeDuration('PT0.001S') returns the number of seconds as a duration, and then divides by 1