<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>XQueryHacker</title>
	<atom:link href="http://www.xqueryhacker.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xqueryhacker.com</link>
	<description>XQuery and MarkLogic development</description>
	<lastBuildDate>Wed, 04 Jan 2012 21:36:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>xray &#8211; an XQuery test framework</title>
		<link>http://www.xqueryhacker.com/2012/01/xray-an-xquery-test-framework/</link>
		<comments>http://www.xqueryhacker.com/2012/01/xray-an-xquery-test-framework/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 21:36:00 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MarkLogic]]></category>
		<category><![CDATA[Test]]></category>
		<category><![CDATA[XQuery]]></category>
		<category><![CDATA[xray]]></category>

		<guid isPermaLink="false">http://www.xqueryhacker.com/?p=295</guid>
		<description><![CDATA[xray is a framework for testing XQuery code on MarkLogic Server. It makes it super easy to write tests as standard XQuery functions. Check out the GitHub repository for more details.]]></description>
			<content:encoded><![CDATA[<p>xray is a framework for testing XQuery code on MarkLogic Server. It makes it super easy to write tests as standard XQuery functions.</p>
<p>Check out the <a href="http://github.com/robwhitby/xray">GitHub repository</a> for more details.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xqueryhacker.com/2012/01/xray-an-xquery-test-framework/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MarkLogic XQuery performance tuning &#8211; computing facets concurrently</title>
		<link>http://www.xqueryhacker.com/2012/01/marklogic-xquery-performance-tuning-computing-facets-concurrently/</link>
		<comments>http://www.xqueryhacker.com/2012/01/marklogic-xquery-performance-tuning-computing-facets-concurrently/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 18:19:14 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[MarkLogic]]></category>
		<category><![CDATA[XQuery]]></category>

		<guid isPermaLink="false">http://www.xqueryhacker.com/?p=285</guid>
		<description><![CDATA[As seems to be quite common in search applications built on MarkLogic, our latest project has a lot of facets, varying from document language with only a handful of values to publication title with over 50,000. Facets are very fast &#8230; <a href="http://www.xqueryhacker.com/2012/01/marklogic-xquery-performance-tuning-computing-facets-concurrently/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As seems to be quite common in search applications built on MarkLogic, our latest project has a lot of facets, varying from document language with only a handful of values to publication title with over 50,000. Facets are very fast to calculate, but with a lot of distinct values in each facet, it can easily take a couple of tenths of a second per facet. With multiple facets the time really starts adding up. Profiling our search queries revealed that over 70% of the time was taken up with faceting.</p>
<p>The code looked something like this. The facets are defined in XML and there is a function to resolve a single facet which is called on each using function mapping. The total time was around 0.5 seconds.</p>
<p><script src="https://gist.github.com/1556015.js?file=cts-element-values-non-concurrent.xqy"></script></p>
<p>The <code>cts:element-values</code> function has an option called &#8216;concurrent&#8217;. The description from the <a href="http://api.xqueryhacker.com/#cts:element-values">API documentation</a>:</p>
<blockquote><p>Perform the work concurrently in another thread. This is a hint to the query optimizer to help parallelize the lexicon work, allowing the calling query to continue performing other work while the lexicon processing occurs. This is especially useful in cases where multiple lexicon calls occur in the same query (for example, resolving many facets in a single query).</p></blockquote>
<p>Unfortunately simply adding the concurrent option to the facet definitions doesn&#8217;t make any difference because the function mapping is blocked waiting for the response of each call. The same would happen if we looped over the facets in a FLWOR statement. </p>
<p>One solution is to rewrite the resolve-facet function to recurse through the facets, only accessing the results of cts:element-values after the recursive call. This way it will loop through the entire sequence of facets first and the expensive calls won&#8217;t be blocked. Total time is now 0.2 seconds &#8211; the time of the slowest facet.</p>
<p><script src="https://gist.github.com/1555988.js?file=cts-element-values-concurrent.xqy"></script></p>
<p>By the way, if you&#8217;re using the MarkLogic search API then there&#8217;s no need to do anything, it already computes facets concurrently &#8211; sorry for wasting your time <img src='http://www.xqueryhacker.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>It&#8217;s also worth noting that this technique isn&#8217;t limited to cts:element-values, other lexicon functions also support the concurrent option.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xqueryhacker.com/2012/01/marklogic-xquery-performance-tuning-computing-facets-concurrently/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>DQ update</title>
		<link>http://www.xqueryhacker.com/2011/03/dq-update-marklogic-cq/</link>
		<comments>http://www.xqueryhacker.com/2011/03/dq-update-marklogic-cq/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 21:38:34 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[DQ]]></category>
		<category><![CDATA[MarkLogic]]></category>
		<category><![CDATA[XQuery]]></category>

		<guid isPermaLink="false">http://www.xqueryhacker.com/?p=256</guid>
		<description><![CDATA[It&#8217;s been a while, but DQ has finally had a bit of attention to add a couple of important missing features: Tab renaming &#8211; double-click on a tab Explore &#8211; new button in toolbar to explore current database Auto-save &#8211; &#8230; <a href="http://www.xqueryhacker.com/2011/03/dq-update-marklogic-cq/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while, but DQ has finally had a bit of attention to add a couple of important missing features:</p>
<p>Tab renaming &#8211; double-click on a tab </p>
<p>Explore &#8211; new button in toolbar to explore current database</p>
<p>Auto-save &#8211; queries are now saved on execute instead of on exit</p>
<p><a href="http://github.com/robwhitby/DQ">http://github.com/robwhitby/DQ</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xqueryhacker.com/2011/03/dq-update-marklogic-cq/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>API interface updated for MarkLogic 4.2</title>
		<link>http://www.xqueryhacker.com/2010/10/api-interface-updated-for-marklogic-4-2/</link>
		<comments>http://www.xqueryhacker.com/2010/10/api-interface-updated-for-marklogic-4-2/#comments</comments>
		<pubDate>Sat, 16 Oct 2010 20:14:36 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[MarkLogic]]></category>
		<category><![CDATA[XQuery]]></category>

		<guid isPermaLink="false">http://www.xqueryhacker.com/?p=251</guid>
		<description><![CDATA[MarkLogic 4.2 is finally out! (http://developer.marklogic.com/products/marklogic-server/4.2) so I&#8217;ve made a few minor changes to the API interface to better support multiple versions of the MarkLogic API. See it in action: http://api.xqueryhacker.com Download/Fork: http://github.com/robwhitby/MarkLogic-API-Interface]]></description>
			<content:encoded><![CDATA[<p>MarkLogic 4.2 is finally out! (<a href="http://developer.marklogic.com/products/marklogic-server/4.2">http://developer.marklogic.com/products/marklogic-server/4.2</a>) so I&#8217;ve made a few minor changes to the API interface to better support multiple versions of the MarkLogic API.</p>
<p>See it in action:<br />
<a href="http://api.xqueryhacker.com">http://api.xqueryhacker.com</a></p>
<p>Download/Fork:<br />
<a href="http://github.com/robwhitby/MarkLogic-API-Interface">http://github.com/robwhitby/MarkLogic-API-Interface</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xqueryhacker.com/2010/10/api-interface-updated-for-marklogic-4-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Search interface to Mark Logic API now on SourceForge</title>
		<link>http://www.xqueryhacker.com/2010/03/search-interface-to-mark-logic-api-now-on-sourceforge/</link>
		<comments>http://www.xqueryhacker.com/2010/03/search-interface-to-mark-logic-api-now-on-sourceforge/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 16:19:14 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Ext JS]]></category>
		<category><![CDATA[MarkLogic]]></category>
		<category><![CDATA[XQuery]]></category>

		<guid isPermaLink="false">http://www.xqueryhacker.com/?p=241</guid>
		<description><![CDATA[Update: The project has now moved to github. http://github.com/robwhitby/MarkLogic-API-Interface The search interface I built to the Mark Logic API (see Searching the Mark Logic API function reference with Mark Logic) is now hosted on SourceForge for anyone to download and &#8230; <a href="http://www.xqueryhacker.com/2010/03/search-interface-to-mark-logic-api-now-on-sourceforge/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div style="color:red;font-weight:bold;padding:10px;border:1px solid #ccc; background-color:#efefef; margin-bottom:20px">Update: The project has now moved to github.<br />
<a href="http://github.com/robwhitby/MarkLogic-API-Interface">http://github.com/robwhitby/MarkLogic-API-Interface</a></div>
<p>The search interface I built to the Mark Logic API (see <a href="http://www.xqueryhacker.com/2010/03/searching-mark-logic-api/">Searching the Mark Logic API function reference with Mark Logic</a>) is now hosted on SourceForge for anyone to download and run locally.</p>
<p><a href="http://mlapi.sourceforge.net">http://mlapi.sourceforge.net</a></p>
<p>Try it out here: <a href="http://api.xqueryhacker.com">http://api.xqueryhacker.com</a></p>
<p>It requires <a href="http://www.marklogic.com">Mark Logic Server</a> v4 (community edition is fine, it&#8217;s only small). There&#8217;s a few steps to the installation, instuctions are in a readme file in the download. Please let me know if there are any problems and I&#8217;ll try to help.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xqueryhacker.com/2010/03/search-interface-to-mark-logic-api-now-on-sourceforge/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Searching the Mark Logic API function reference with Mark Logic</title>
		<link>http://www.xqueryhacker.com/2010/03/searching-mark-logic-api/</link>
		<comments>http://www.xqueryhacker.com/2010/03/searching-mark-logic-api/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 17:54:37 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Ext JS]]></category>
		<category><![CDATA[MarkLogic]]></category>
		<category><![CDATA[XQuery]]></category>

		<guid isPermaLink="false">http://www.xqueryhacker.com/?p=226</guid>
		<description><![CDATA[I&#8217;ve always thought it odd that the Mark Logic API function reference isn&#8217;t searchable. It seems obvious that it should be loaded into Mark Logic itself. Most of the time I use it for looking up the signature of a &#8230; <a href="http://www.xqueryhacker.com/2010/03/searching-mark-logic-api/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always thought it odd that the <a href="http://developer.marklogic.com/pubs/4.1/apidocs/All.html">Mark Logic API function reference</a> isn&#8217;t searchable. It seems obvious that it should be loaded into Mark Logic itself. Most of the time I use it for looking up the signature of a particular function, take <a href="http://developer.marklogic.com/pubs/4.1/apidocs/Lexicons.html#cts:uris">cts:uris()</a> for example &#8211; can anyone remember what order the parameters go in? Finding a function detail page from the home page is a mission, so I always just hit F3 to search the home page.</p>
<p>So anyway, I loaded the content into Mark Logic and built a quick interface using <a href="http://www.extjs.com">ExtJS</a>. We&#8217;ve been using it at work for about 6 months, and it&#8217;s now got a new home at <a href="http://api.xqueryhacker.com">api.xqueryhacker.com</a>. You can choose to search just function names or all content, and browse by namespace. There&#8217;s a link in the header to switch between version 4.0 and 4.1 of the API.</p>
<p>In the next few weeks I&#8217;ll tidy up the code and put it up on SourceForge so if anyone&#8217;s interested they can install it locally &#8211; I&#8217;m not really intending to publicly host it permanently.</p>
<p>As always, all feedback welcome..</p>
<p><a href="http://api.xqueryhacker.com">api.xqueryhacker.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xqueryhacker.com/2010/03/searching-mark-logic-api/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Early version of DQ &#8211; an alternative interface for Mark Logic&#8217;s CQ XQuery editor</title>
		<link>http://www.xqueryhacker.com/2010/01/early-version-of-dq-an-alternative-interface-for-mark-logics-cq-xquery-editor/</link>
		<comments>http://www.xqueryhacker.com/2010/01/early-version-of-dq-an-alternative-interface-for-mark-logics-cq-xquery-editor/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 14:17:37 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[DQ]]></category>
		<category><![CDATA[MarkLogic]]></category>
		<category><![CDATA[XQuery]]></category>

		<guid isPermaLink="false">http://www.xqueryhacker.com/?p=214</guid>
		<description><![CDATA[Update: The project has now moved to github. http://github.com/robwhitby/DQ DQ v0.2 now available Here&#8217;s a very early version of a new interface to CQ that I&#8217;m slowly working on, imaginatively named DQ. It aims to address a number of shortcomings &#8230; <a href="http://www.xqueryhacker.com/2010/01/early-version-of-dq-an-alternative-interface-for-mark-logics-cq-xquery-editor/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div style="color:red;font-weight:bold;padding:10px;border:1px solid #ccc; background-color:#efefef; margin-bottom:20px">Update: The project has now moved to github.<br />
<a href="http://github.com/robwhitby/DQ">http://github.com/robwhitby/DQ</a></div>
<p><a href="http://www.xqueryhacker.com/2011/03/dq-update-marklogic-cq/">DQ v0.2 now available</a></p>
<p>Here&#8217;s a very early version of a new interface to <a href="http://developer.marklogic.com/code/">CQ</a> that I&#8217;m slowly working on, imaginatively named <a href="https://sourceforge.net/projects/mldq/">DQ</a>. It aims to address a number of shortcomings in CQ, the web XQuery interface provided by <a href="http://www.marklogic.com">Mark Logic</a>.</p>
<p><strong>Current features</strong><br />
Tabbed code editor (based on <a href="https://sourceforge.net/projects/editarea/">EditArea</a>) with XQuery syntax highlighting, search and replace, and support of tab key<br />
Save queries and results to file system<br />
Auto-save of all query tabs using browser local storage (no more session confusion)<br />
Highlighting a section of code and executing will run just the selected code (inspired by SQL Query Analyzer!)</p>
<p><strong>Future features</strong><br />
Integration of XQuery API reference<br />
Function auto-complete<br />
More suggestions welcome!</p>
<p><strong>Requirements</strong><br />
Recent version of <a href="http://developer.marklogic.com/code/">CQ</a> installed (I&#8217;m using 4.1.2)<br />
Firefox 3.5 or IE8 (Chrome doesn&#8217;t style XML output, Safari and Opera not yet tested)</p>
<p><strong>Installation</strong><br />
Unzip DQ folder in root of your CQ directory<br />
Browse to: http://SERVER:CQPORT/DQ</p>
<p>The project is up on sourceforge:<br />
<a href="https://sourceforge.net/projects/mldq/">https://sourceforge.net/projects/mldq/</a></p>
<p>Please give it a go and let me know what you think. I&#8217;d be interested in suggestions on improvements, extra features etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xqueryhacker.com/2010/01/early-version-of-dq-an-alternative-interface-for-mark-logics-cq-xquery-editor/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Error restoring a Mark Logic forest</title>
		<link>http://www.xqueryhacker.com/2009/12/error-restoring-a-mark-logic-forest/</link>
		<comments>http://www.xqueryhacker.com/2009/12/error-restoring-a-mark-logic-forest/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 16:49:47 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MarkLogic]]></category>

		<guid isPermaLink="false">http://www.xqueryhacker.com/?p=201</guid>
		<description><![CDATA[After it spent about 2 hours restoring a forest I got an annoying but slightly amusing error: 500 Internal Server Error XDMP-EXTIME: xdmp:sleep(3000) -- Time limit exceeded in /forest-backup-go.xqy, on line 56 [0.9-ml] Now what do I do? Try again &#8230; <a href="http://www.xqueryhacker.com/2009/12/error-restoring-a-mark-logic-forest/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After it spent about 2 hours restoring a forest I got an annoying but slightly amusing error:</p>
<p>
<pre>500 Internal Server Error

XDMP-EXTIME: xdmp:sleep(3000) -- Time limit exceeded
in /forest-backup-go.xqy, on line 56 [0.9-ml]</pre>
</p>
<p>Now what do I do? Try again and cross fingers this time?</p>
<p>And why is restore not async in the admin ui? Backup is..</p>
<p>This is just the first forest, there&#8217;s another 4 to go. Not what I need on Friday afternoon <img src='http://www.xqueryhacker.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>Rant over.</p>
<p>UPDATE&#8230; Rookie mistake believing the error message meant the restore had failed &#8211; turns out it has worked!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xqueryhacker.com/2009/12/error-restoring-a-mark-logic-forest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle slates &quot;inferior&quot; Mark Logic</title>
		<link>http://www.xqueryhacker.com/2009/12/oracle-slates-inferior-mark-logic/</link>
		<comments>http://www.xqueryhacker.com/2009/12/oracle-slates-inferior-mark-logic/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 21:26:10 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MarkLogic]]></category>
		<category><![CDATA[Oracle XML DB]]></category>

		<guid isPermaLink="false">http://www.xqueryhacker.com/?p=190</guid>
		<description><![CDATA[Oracle have published a PDF comparing their new XML DB to Mark Logic 4.1. It&#8217;s amazing how openly hostile they are. Instead of comparing the two products on any meaningful basis, they resort to making vague, unsubstantiated claims about their &#8230; <a href="http://www.xqueryhacker.com/2009/12/oracle-slates-inferior-mark-logic/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Oracle have <a href="http://www.oracle.com/technology/tech/xml/xmldb/Current/marklogicserver_4.1_v1.0.pdf">published a PDF</a> comparing their new <a href="http://www.oracle.com/technology/tech/xml/xmldb/index.html">XML DB</a> to <a href="http://www.marklogic.com">Mark Logic 4.1</a>.</p>
<p>It&#8217;s amazing how openly hostile they are. Instead of comparing the two products on any meaningful basis, they resort to making vague, unsubstantiated claims about their superiority. It really comes across as desperation and highlights that Oracle clearly feel threatened by Mark Logic. It&#8217;ll be interesting to see how Mark Logic respond &#8211; CEO Dave Kellogg has said he&#8217;ll post a response on <a href="http://marklogic.blogspot.com/">his blog</a> in the next few days.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xqueryhacker.com/2009/12/oracle-slates-inferior-mark-logic/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SyntaxHighlighter XQuery brush</title>
		<link>http://www.xqueryhacker.com/2009/11/syntaxhighlighter-xquery-brush/</link>
		<comments>http://www.xqueryhacker.com/2009/11/syntaxhighlighter-xquery-brush/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 11:34:43 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MarkLogic]]></category>
		<category><![CDATA[SyntaxHighlighter]]></category>
		<category><![CDATA[XQuery]]></category>

		<guid isPermaLink="false">http://www.xqueryhacker.com/?p=166</guid>
		<description><![CDATA[Update: Now hosted on GitHub: http://github.com/robwhitby/SyntaxHighlighter-XQueryBrush I&#8217;ve just improved the code snippets in my posts by using the excellent SyntaxHighlighter by Alex Gorbatchev. I had to write a new brush for XQuery, but this was pretty straightforward (it has a &#8230; <a href="http://www.xqueryhacker.com/2009/11/syntaxhighlighter-xquery-brush/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div style="color:red;font-weight:bold;padding:10px;border:1px solid #ccc; background-color:#efefef; margin-bottom:20px">Update: Now hosted on GitHub:<br />
<a href="http://github.com/robwhitby/SyntaxHighlighter-XQueryBrush">http://github.com/robwhitby/SyntaxHighlighter-XQueryBrush</a></div>
<p>I&#8217;ve just improved the code snippets in my posts by using the excellent <a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter">SyntaxHighlighter</a> by Alex Gorbatchev.</p>
<p>I had to write a new brush for XQuery, but this was pretty straightforward (it has a much better extension system than I found in Notepad++ for example). As well as XQuery 1.0 functions, keywords etc. I&#8217;ve included the MarkLogic 4.1 API.</p>
<p>Here&#8217;s an example..</p>
<pre class="brush: xquery;">xquery version '1.0-ml';
declare variable $URI as xs:string external;

declare function local:document-move-forest($uri as xs:string, $forest-ids as xs:unsignedLong*)
{
	xdmp:document-insert(
		$uri,
		fn:doc($uri),
		xdmp:document-get-permissions($uri),
		xdmp:document-get-collections($uri),
		xdmp:document-get-quality($uri),
		$forest-ids
	)
};

let $xml :=
  <xml att="blah" att2="blah">
    sdasd<b>asdasd</b>
  </xml></pre>
<p></code><br />
If you want to use it download <a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter:Download">SyntaxHighlighter</a>, and then get the XQuery brush files from GitHub:<br />
<a href="http://github.com/robwhitby/SyntaxHighlighter-XQueryBrush">http://github.com/robwhitby/SyntaxHighlighter-XQueryBrush</a></p>
<p>Example usage:</p>
<pre class="brush: xml;">
&lt;script type="text/javascript" src="scripts/shCore.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="scripts/shBrushXQuery.js"&gt;&lt;/script&gt;
&lt;link type="text/css" rel="stylesheet" href="styles/shCore.css"/&gt;
&lt;link type="text/css" rel="stylesheet" href="styles/shThemeDefault.css"/&gt;
&lt;link type="text/css" rel="stylesheet" href="styles/shThemeXQuery.css"/&gt;
&lt;script type="text/javascript"&gt;
	SyntaxHighlighter.config.clipboardSwf = 'scripts/clipboard.swf';
	SyntaxHighlighter.all();
&lt;/script&gt;

&lt;pre class="brush: xquery;"&gt;xquery version '1.0-ml';&lt;/pre&gt;
</pre>
<p>Next job is to change the layout of this blog to make the content column wider...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xqueryhacker.com/2009/11/syntaxhighlighter-xquery-brush/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

