xquery

Finding the differences only between 2 strings in SQL

二次信任 提交于 2019-12-25 06:39:10
问题 I must compare 2 xml strings(varchar(max) in sql) like these ones: '<table_name id="2" name="Bob" job="student"/>' '<table_name id="2" name="john" job="teacher"/>' And the result must be the differences only, which means, ill get 2 strings, the first one will me the original values, and the second one will be the new values. However if there are no differences then there will be an empty string, in this case for example: output 1: 'name="Bob", job="student"' output 2: 'name="john", job=

Remove newline character/white space from xml using xslt or xquery transformation

六月ゝ 毕业季﹏ 提交于 2019-12-25 06:33:48
问题 How to remove newline character/white space from xml using xslt or xquery transformation.Means all the elements will come in a single line. 回答1: In xslt, you can add a top level element <xsl:strip-space elements="*"/> By using a sample input XML below: <?xml version="1.0" encoding="utf-8"?> <root> <a>XXX</a> <b>YYY</b> <c>ZZZ</c> </root> and the following XSLT: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:strip

xpath/xquery sql - Get all values

送分小仙女□ 提交于 2019-12-25 05:24:30
问题 Hi I have a blob of xml.. <string>1</string> <string>2</string> <string>3</string> <string>4</string> <string>11</string> <string>1211</string> <string>12331</string> how would I get all the values using xpath/xquery in SQL Thanks 回答1: The xpath //string will return all the values in the intire xml the xpath /string will return only the values in the root node. And for using it in sql look at this post XPath to fetch SQL XML value 回答2: in oracle database you have XMLType (see this) data type.

Insertion into multiple tables in sql server via xml

可紊 提交于 2019-12-25 05:23:18
问题 I want to do inserts into multiple tables, i.e. Customer, Account, AccountTransactions Edit Entity - Customer one to one Customer - Account is mapped as one to one Account - AccountTransactions are mapped as one to many Entity(EntityId, EntityType) EntityId primary key Auto incremented Customer(CustomerId, FName, LName) CustomerId = EntityId primary key Account(AccountId, AccountNo, CustomerId) AccountId PK, CustomerId FK AccountTransactions(TransactionId, PaymentDate, CurrentBalance,

Sort XML Attributes in SQL

放肆的年华 提交于 2019-12-25 05:13:34
问题 How to sort XML Attributes in SQL? for example for this XML: <books><book b='' c='' a=''/></books> I want: <books><book a='' b='' c=''/></books> 回答1: From http://msdn.microsoft.com/en-us/library/ms187107%28v=sql.90%29.aspx: The order of the XML attributes is not preserved. When you query the XML instance stored in the xml type column, the order of attributes in the resulting XML may be different from the original XML instance. So even if you could figure out a way of sorting the attributes,

How to upload docx, xlsx & txt files to Marklogic Server?

和自甴很熟 提交于 2019-12-25 05:01:36
问题 I have a folder which contains doc, docx, xlsx, pdf and txt files. I am uploading all these files into Marklogic with this XQuery:- for $d in xdmp:filesystem-directory("C:\uploads")//dir:entry return xdmp:document-load($d//dir:pathname, <options xmlns="xdmp:document-load"> <uri>{concat("/documents/", string($d//dir:filename))}</uri> <permissions>{xdmp:default-permissions()}</permissions> <collections>{xdmp:default-collections()}</collections> <format>binary</format> </options>) I have also

Debugger for XQuery that uses Saxon

随声附和 提交于 2019-12-25 04:41:12
问题 Can anyone suggest a debugger for XQuery? I would prefer one that is either online or works within Eclipse, and I prefer something that uses Saxon. So far, all I've found is XQDT (which has little documentation and does not work with Saxon) and a few stand-alone commercial apps. All I want to do is understand why my XQuery isn't selecting the elements I think it should. (My requirement for Saxon is because I've had bad experiences with these processors not meeting the same standard.) Any

How to get file extension in Marklogic Server?

╄→尐↘猪︶ㄣ 提交于 2019-12-25 04:29:09
问题 I want to get the file extension of uploaded file in Marklogic server. I know how to get the file name. But that gives filename plus extension like new.txt. But I want only extension not the full file name. How can I get just the file extension ? 回答1: There are many methods of getting file extensions from filename. For instance you can use functx:substring-after-last($filename, '.') or other methods (fn:substring-after) of getting substring after dot. Please see: xqueryfunctions.com P.S. fn

how to count common nodes between two nodes in sql

南楼画角 提交于 2019-12-25 04:28:21
问题 How to count common nodes between two nodes in sql for this example: count <li> tags between <h2 id="vgn">VGN A </h2> and <h2 id="vgn">VGN </h2> and the number of <h2> tags. In other words: count of li between h2 number1 and h2 number 2 in this example. <table class="table table-condensed table-no-border table-brand-main"> <tr><td><h2 id="vgn">VGN A </h2></td></tr> <tr><td> <style> ul.brand_572 { -moz-column-count: 6; -webkit-column-count: 6; column-count: 6; } ul.brand_572 li { width:120px;

Eclipse Xquery For Complex payload

风格不统一 提交于 2019-12-25 03:42:34
问题 I have the input request like below <Input> <BusinessObjects> <BusinessObject> <BusinessIdentifiers> <BusinessIdentifier> <BKey>BuCode</BKey> <BValue>CDC</BValue> </BusinessIdentifier> <BusinessIdentifier> <BKey>BuType</BKey> <BValue>123</BValue> </BusinessIdentifier> <BusinessIdentifier> <BKey>CsmNo</BKey> <BValue>857895</BValue> </BusinessIdentifier> </BusinessIdentifiers> </BusinessObject> <BusinessObject> <BusinessIdentifiers> <BusinessIdentifier> <BKey>BuCode</BKey> <BValue>CDC</BValue>