Questions tagged [xquery]

XQuery is a functional language designed to query and manipulate XML data. It is a superset of XPath, to which it adds features such as the creation of new nodes and more powerful FLWOR expressions. Although it shares its data model with XSLT, XQuery is optimized for querying rather than transforming data, and as such it has a different design inspired by SQL.

Filter by
Sorted by
Tagged with
0 votes
0 answers
18 views

How do I replace an absolute path in XQUERY -

`I'm trying to replace the following query which retrieves a logo from my IDM database with a query that uses the customer number from my XML instead. Current query: { "xpath": null, "...
0 votes
0 answers
32 views

how to find value of next index in each for loop iteration in xquery

xquery version "1.0-ml"; import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; declare variable $totalhosts := xdmp:host-name(...
  • 477
-1 votes
1 answer
37 views

increment the position value of an index every time in for loop in xquery

xquery version "1.0-ml"; import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; declare variable $totalhosts := xdmp:host-name(...
  • 477
0 votes
1 answer
54 views

SQL Server: querying from string xml value

I need to join some XML data with relational data and to do it in a pure non-procedural SQL Server. I may pass the desired xml as a (n)varchar or even lexical parameter. Since all the examples I've ...
  • 13
0 votes
1 answer
20 views

XML data to SQL tables, difficulty gettting child node data

I have an xml file that I am loading into SQL. I have no problem getting the xml file loaded and the top level nodes into a sql table. I am having difficulty reaching the next level child node. ...
-1 votes
1 answer
33 views

Highlight row in HTML table in SQL if the row exists in another table

I use this query to send alerts. I would like a row to be highlighted if a Group ID is in the #GroupsProcessed table, but not to show any additional columns. The status is always the same for the ...
  • 57
0 votes
1 answer
15 views

How to pass the values of request:get-parameter to the variables in Xquery to be used in a XSLT template to generate a HTML output

I have this xml file: <A9-ArchaeologicalExcavation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <E53-Place> <Name>asdad</Name> <...
0 votes
1 answer
28 views

Using Modifier Functions after the op:reduce() Function in an Optic Access Plan

Is it possible to use optic modifier functions like op:group-by(), op:where(), etc. after running the op:reduce() function? I haven't been able to find anything in the Optic API Dev Guide regarding ...
  • 97
0 votes
1 answer
40 views

How to retrieve XML element childs as a string in XQuery

I'm using MarkLogic database and I want to retrieve XML element's value, including it's child element tags and values in a string using XQuery. e.g. I have text element. <text_element> This &...
  • 25
1 vote
3 answers
49 views

Using T-SQL Xquery to extract data from XML with low-ascii represented like "&amp;#x1E"? Or just use T-SQL?

I have strings inside XML that contain low-order ASCII. Specifically, the EDI contains special characters like char(28), char(29), char(30) (aka File Separator/Group Separator/Record Separator). The ...
  • 1,236
0 votes
1 answer
31 views

Set XML column dynamically

I want to modify a value inside an XML tag dynamically, the stored procedure runs correctly but does not modify the value. This is the query: DROP TABLE IF EXISTS #IDsToUpdate SELECT biCustNoteID, ...
0 votes
1 answer
32 views

How to get the XML Node's elements and properties from an XML format using TSQL

I have an XML format that looks like this: <Properties> <Property name="AllowAccess" type="ComboBox" displayName="Contracts:" default="0" tabs="...
  • 17
0 votes
1 answer
39 views

Add element names dynamically to array-element-names configuration of json:transform-to-json() in Marklogic

I'm doing a cts:search and converting the result nodes to JSON using json:transform-to-json() function in MarkLogic 10. Sample code: let $config := json:config("custom") let $response := cts:...
  • 175
0 votes
1 answer
23 views

Filter table by an XML column where they have equal values - SQL Server 2017

I need to filter the records of a table where the values of an XML component are equal. TempTable ID noteID columnXML 1 342342 xml1 2 235987 xml2 and the structure of the xml is the following: <...
0 votes
1 answer
26 views

Xquery group by on key fields and concatenate elements

I have a large well formated XML payload. I need to look through the XML and based on a key SupporterID and CampaignNumber, group the records and concatenate the CampaignID field with * delimeters. ...
0 votes
1 answer
38 views

Getting Zero Length String with an iterative Xquery

Im running the following on an CSV payload via API Call to convert it into XML and trying to maintain the field names of the CSV for each row, but when testing it seems to work fine, but fails on with ...
1 vote
2 answers
57 views

Deleting multiple nodes from XML with XQuery

I have XML that looks something like that: <1> <2> <3> <3> <3> </2> <2> <3> <3> </2> ...
  • 23
1 vote
1 answer
90 views

Send HTTP Request from local server to remote server

I am using BaseX version 9.5, I am trying to send HTTP request from local to remote server to read database, but not getting the response. let $server := 'http://10.102.xxx.xxx:8984/rest/' let $...
1 vote
1 answer
42 views

Breaking up a sequence of id numbers using tokenize

I have an XML file that looks like this: <cosmetics> <cosmetic id="0" itemIDs="1879053261,1879053932,1879054863"/> <cosmetic id="1" itemIDs="...
0 votes
0 answers
26 views

Write and read document in the same run

I am using BaseX version 9.5 and trying to ingest docs into database and read it in the same run: let $result := for $i in 1 to 10 return ( db:...
2 votes
2 answers
21 views

Invoking an XQuery Updating function results in the error If any subexpression is updating, then all must be updating

My XML document contains a record of the movement of an object. The XML document consists of a series of observations. Each observation contains the lat/long location of the object, the lat/long of ...
-1 votes
1 answer
87 views

What is the Venn diagram for XPath, XQuery, and XQuery Update?

Note: in all of the following, when I refer to "XQuery" I mean the latest version of XQuery. Ditto for XQuery Update. [True or False] XQuery is a superset of XPath. That is, the XQuery ...
1 vote
1 answer
34 views

T-SQL combine based on values with for XML path

I am running stuck in something I can't get my head around. I have some mock-up data to simulate: DECLARE @tbl TABLE (orderReference VARCHAR(50), shipmentReference VARCHAR(50), additionalComments ...
  • 70
0 votes
1 answer
35 views

How to run Saxon on an XQuery Update file from the command line?

This page [1] on the Saxon web site says: Update is available only in Saxon-EE, and is supported only if explicitly requested. The command line has an option -update:on for this purpose ... and ...
1 vote
1 answer
43 views

Convert child nodes into a single string using XQuery in ML 10

We have an application whose backend ML response format is JSON and we have a element with both text and nodes as below. <Title>Header <bold>abc</bold></Title> Now, while ...
  • 175
0 votes
2 answers
107 views

How to use the collection()-function with saxonche

I am trying to use the collection()-function using the new saxonche-Python-Module (https://pypi.org/project/saxonche/). I would expect, that it returns all XML-documents inside the current directory. ...
  • 152
0 votes
0 answers
43 views

Error while using format-number function in xquery

I am using camel-saxon dependency in my project and trying to use format-number function in xquery but getting "System function format-number#2 is not available with this host language/version&...
  • 13
-1 votes
1 answer
26 views

Extract all the XML entry key values as rows using SQL

I'm trying to extract the key values (1,2,3) from a single row in a table, but I'm only able to extract a single row at a time using what I know: cast([attributes] as XML).value('(//Map/entry[@key=&...
  • 9
1 vote
1 answer
53 views

Generate AWS Signature in MarkLogic XQuery - can't reproduce example hash

I need to send a GET request to AWS from MarkLogic and sign the URL. I was using the AWS documentation to understand how the signature gets created but what I get and what I expect to get aren't the ...
  • 15
0 votes
1 answer
23 views

MarkLogic json:transform-to-json config to skip XML root element

I'm using MarkLogic json:transform-to-json to produce JSON from XML. I can't figure out the right config options to skip the root element in the XML, and only show the immediate children and further ...
  • 15
2 votes
2 answers
69 views

How to return last node having namespace in it using Xquery

I have this file, which have namespaces in it, I am trying to write a Xquery which will return, the last node having the namespace, but unabe to find the logic to return the namespace node(PS: I am ...
0 votes
2 answers
42 views

Validate if the XML has a tag "string" using XQuery

I need to check if the xml has a "OperationResponse" in it and if yes, i need to perform some actions using XQuery. I tried few things and was not successfull. Below is an example of ...
0 votes
2 answers
45 views

Selecting Node for every time another node is repeated with XQuery with IMPORTXML on Google Sheets

So here's what I want to do. The following is the xml info (simplified) I get from an invoicing program. I would like to select the Invoicer Name for every time I have a different product. So in my ...
0 votes
1 answer
48 views

XQuery Creating a Variable that contains a List Condition

I am very new to Xquery. Here's what I am trying to do: let $numbers := ('1', '2', '3', '6') let $answers := $document//answer[number/@number = 'ABC' and ........] for $answer in $answers let... ...
0 votes
1 answer
37 views

replacing value of a node in XML using parameters to set a given node

I under stand the basics of "replacing" a value in xml in the very basic sample below. But I have a more complicated XML. What I am trying to do is update the node of a given where the ...
1 vote
2 answers
93 views

Openxml select data from complex xml having prefix

The XML structure and expected result is below, I can loop through all the data but unable to pick xml elements from xpath as the item node is prefixed with "a:" I have tried following but ...
0 votes
2 answers
95 views

Loading data from an XML document (not a file)

I have a lot of logfiles that I want to load into a SQL Server database via a Talend job so that I can preserve the logs without keeping the files in the file system (we generate over 3k log files ...
  • 23
0 votes
1 answer
39 views

Update all attributes of a node in XQUERY

I have a node with attributes and children. <node attr1="value1" attr2="value2"><child1/><child2/></node> I have a second node with a different set of ...
  • 932
1 vote
3 answers
59 views

XQuery: Separate a sequence into multiple ones

I want to seperate a sequence into multiple ones. So e.g. I have this sequence let $allNumbers := (1,2,3,4,5) And I want as an result one sequence with all number less than 3 and one sequence with ...
0 votes
1 answer
23 views

How do i get the `ResponseDescription` value in Microsoft Sql?

So the column i'm querying has an XML data that looks like this <soap:Envelope xmlns:soap="http://google.com/"> <soap:Body> <ns2:response xmlns:ns2="http://...
  • 1
0 votes
1 answer
25 views

Speeding up xqueries containing DOM objects

We are currently using DOM objects in our code to run xqueries. The aim is to shift to TinyTree,to improve performance of queries, however a large amount of time is taken to convert a dom to tiny tree ...
0 votes
1 answer
39 views

Parse an xml file without dups

How can I have the Attribute_ID in the column and Attribute_Value as value to be populated in the table. Below is XML doc: <ExperianBureauData> <NetConnectResponse> <...
  • 13
0 votes
2 answers
55 views

XQUERY - modify using multiple variables

I am writing a stored procedure where I can add/modify any XML nodes with a supplied value on a XML column. @XML xml, @NODENAME nvarchar(100) = NULL, @NODEVALUE nvarchar(max) are being passed as ...
  • 2,147
0 votes
1 answer
78 views

SQL: Query XML node value, exclude nested node

I'm having trouble importing a new XML format into our MS SQL database. My document is looking similar to this. <xml> <data> <email>test@mail.com</email> <isActive&...
  • 1
0 votes
1 answer
58 views

Insert order details from XML into SQL database table

I want to insert this XML file (API Response) into a database table as columns. when the response consist of two different items for unique order id, order id column should be inserted for both ...
  • 39
0 votes
1 answer
54 views

XQuery Inject data for testing

I have a library module (lib) with functions in which variables from another module (const) are used. I now want to test the functions from the lib module in a test module. I have tried changing the ...
3 votes
1 answer
71 views

Optimize retrieval of records when quering between multiple collections in marklogic

I am trying to query between 2 collections having a join condition between them, Say the 2 documents are: Collection 1: Company (1M documents) Company Documents: <Company> <CompanyName>...
  • 31
1 vote
1 answer
58 views

How to process multiple XPath or XQuery expressions in streaming mode efficiently

I need to evaluate multiple XPath (or possibly XQuery - I have some freedom to change the design here) expressions over a larger number of huge XML documents, potentially gigabyte size. If the files ...
  • 5,800
-1 votes
1 answer
96 views

XQuery Delete all unnecessary nodes T-SQL

Could you help me please with succh problem. I have an XML like: <Root attr1="val1"> <El1><Child1/></El1> <El2><Child2/></El2> ... &...
0 votes
2 answers
33 views

Query XML column using another column

I have a SQL table Products with 2 columns as below. ID ProductDetails 2 <XML> 3 <XML> The XML column holds the following data: <Products> <product key="0" ...
  • 5

1
2 3 4 5
106