marklogic

How do I find duplicate data in xml document using XQuery?

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? ...

How to unencode escaped XML with xQuery

I have a variable in xQuery of type xs:string with the value of an encoded HTML snippet (the content of a twitter tweet). It looks like this: Headlines-Today &#8226; AP sources: &lt;b&gt;Obama&lt;/b&gt; pick for Justice post withdraws : News - Rest Of World - &lt;a href=&quot;http://shar.es/mqMAG&amp;quot;&amp;gt;http://shar....

How to get node without children in xQuery?

So I have two nodes of elements that I'm essentially trying to join. I want the top level node to stay the same but the child nodes to be replaced by those cross referenced. Given: <stuff> <item foo="foo" boo="1"/> <item foo="bar" boo="2" /> <item foo="baz" boo="3"/> <item foo="blah boo="4""/> </stuff> <list a="1" b="2"> <f...