I have a bunch of documents in a MarkLogic xml database. One document has:
<colors>
<color>red</color>
<color>red</color>
</colors>
Having multiple colors is not a problem. Having multiple colors that are both red is a problem. How do I find the documents that have duplicate data?
...
I've been tasked with writing some XSLT 2.0 to translate an XML document to another XML document. I'm relatively new to XSLT but I have learn alot during the days I've do this. During this time I have had to map simple values, i.e. 002 -> TH etc. This has been fine for small lists of less than 10 values, I used xsl:choose. However I need...
I have a table that stores data about errors that occur (via SSIS) , the main column that has information is stored as XML. I want to be able to query name/value pairs in this column.
To explain in SQL->(Select * from #tmp Where seq='7406834')
CREATE TABLE #tmp(id INT, category varchar(10), details xml)
INSERT INTO #tmp(id,category,d...
Is it possible to open 2 documents from an xQuery and do a join on them?
...
I've been working with a document repository using XQuery (via Java and .NET interfaces) and was wondering if anyone has any recommendations for unit testing XQuery modules?
...
I can easily select all comments from XML by
select @XML.query('comment()')
but can't find how to delete them. Is there appropriate syntax for @XML.modify('delete ...')?
...
I have an untyped XML column in Sql Server Database which holds values such as
1
<root><a>123</a></root>
<root>23d</root>
23
I was trying with the following query
declare @x xml
set @x='1'
select @x.exist('xs:int(.)')
But here the problem is exist function will return 1 even if @x='<root><a>12</a></root>'
I would like the ou...
I have a column in a SQL Server 2005 table defined as an XML column. Is there a way to select records from this table based on the order of two nodes in that column? For example, we have the following structure in our XML:
<item>
<latitude/>
<longitude/>
</item>
I want to see if there are any records that have latitude/longitu...
How do I select the inner text of an XML node using XQuery?
Microsoft Books Online shows how to retrive an attribute below:
DECLARE @myDoc xml
DECLARE @ProdID int
SET @myDoc = '<Root>
<ProductDescription ProductID="1" ProductName="Road Bike">
<Features>
<Warranty>1 year parts and labor</Warranty>
<Maintenance>3 year parts and labor...
I have an XML document I generate on the fly, and I need a function to eliminate any duplicate nodes from it.
My function looks like:
declare function local:start2() {
let $data := local:scan_books()
return <books>{$data}</books>
};
Sample output is:
<books>
<book>
<title>XML in 24 hours</title>
<author>Some Guy</a...
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...
I can get the first record back from the code below in SQL Server 2005. How do I get them all? If I remove the '[1]' index I get some singleton error...
declare @xml xml
set @xml =
'<my:myFields xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-03-16T20:13:11">
<my:field>test1</my:field>
<my:field>test2</my:fie...
I am trying to match against ids stored as list element using XQuery.
For example,
<data>
<item>
<name>foo</name>
<intValues>1 2 3 4 5</intValues>
</item>
<item>
<name>bar</name>
<intValues>6 7 8 9 10</intValues>
</item>
</data>
is it possible to return items that include 3 in the intValues?
...
So to expand...
I have some XML
<root>
<list>
<item value="9"/>
<item value="3"/>
<item value="1"/>
<item value="8"/>
<item value="4"/>
</list>
</root>
I have an XPath "/root/list/item [4]" which I believe will retrieve the 5th 'item' element (whose value attribute is 4)
This suggest...
I'm writing a user-defined function to extract values from an XML column in SQL Server which represents a simple dictionary of string key-value pairs. The only way I've made it work so far seems overly complex. Do you have any simplifying suggestions or tips for the DictValue function below?
IF EXISTS (SELECT * FROM sys.objects WHERE...
I want to be able to grab content from web pages, especially the tags and the content within them. I have tried XQuery and XPath but they don't seem to work for malformed XHTML and REGEX is just a pain.
Is there a better solution. Ideally I would like to be able to ask for all the links and get back an array of URLs, or ask for the text...
I have a function which contains a constructor:
declare function local:Construct ($id)
{
<tag id="{$id}"/>
}
I use the function in return of "FLWOR":
for $val in ...
...
return local:Construct(data($val/id))
This works.
Now I want to concatenate two Constructs like this
for $val in ...
...
return local:Construct(data($val/id1)...
Hi all,
I what to use XQuery to convert string like "aaa=1&bbb=2" into xml
<request>
<aaa>1</aaa>
<bbb>2</bbb>
</request>
I have tried the following code, but failed!
xquery version "1.0" encoding "GBK";
(:: pragma type="xs:anyType" ::)
declare namespace xf = "http://tempuri.org/BNetAP/Xquery/query2xml/";
declare function x...
I noticed that DataLogic (or is it MarkLogic?) and SqlServer 2005 both support xquery for RDBMS access and (seem to; haven't tried this myself yet) offer xquery inside JSP/ASP.
That leads me to wonder whether java code could disappear from the presentation layer. I.e. JSP/ASP would only contain html plus xquery code that accesses the DBM...
For, example, there is an xml:
<article-list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="3.xsd">
<article section="physics">
Increasing linear dynamic range of commercial digital photocamera
<author>M. V. Konnik</author>
<content>
Methods of increasing linear optical dyna...