<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Parsing XML in Clojure</title>
	<atom:link href="http://techbehindtech.com/2010/06/25/parsing-xml-in-clojure/feed/" rel="self" type="application/rss+xml" />
	<link>http://techbehindtech.com/2010/06/25/parsing-xml-in-clojure/</link>
	<description>Raw information. No finesse :)</description>
	<lastBuildDate>Tue, 26 Feb 2013 22:12:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Otavio Macedo</title>
		<link>http://techbehindtech.com/2010/06/25/parsing-xml-in-clojure/#comment-267</link>
		<dc:creator><![CDATA[Otavio Macedo]]></dc:creator>
		<pubDate>Mon, 02 Jan 2012 12:50:07 +0000</pubDate>
		<guid isPermaLink="false">https://sivajag.wordpress.com/?p=68#comment-267</guid>
		<description><![CDATA[Hey, Siva,

I have been playing with your example, making slight changes to understand what each function does. Could you explain me why does this code doesn&#039;t work?

    (get-value xml :friends :person :name)

Thank you]]></description>
		<content:encoded><![CDATA[<p>Hey, Siva,</p>
<p>I have been playing with your example, making slight changes to understand what each function does. Could you explain me why does this code doesn&#8217;t work?</p>
<p>    (get-value xml :friends :person :name)</p>
<p>Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Siva Jagadeesan</title>
		<link>http://techbehindtech.com/2010/06/25/parsing-xml-in-clojure/#comment-241</link>
		<dc:creator><![CDATA[Siva Jagadeesan]]></dc:creator>
		<pubDate>Tue, 08 Mar 2011 21:50:46 +0000</pubDate>
		<guid isPermaLink="false">https://sivajag.wordpress.com/?p=68#comment-241</guid>
		<description><![CDATA[Thanks Shantanu.

I have updated the urls.]]></description>
		<content:encoded><![CDATA[<p>Thanks Shantanu.</p>
<p>I have updated the urls.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shantanu Kumar</title>
		<link>http://techbehindtech.com/2010/06/25/parsing-xml-in-clojure/#comment-240</link>
		<dc:creator><![CDATA[Shantanu Kumar]]></dc:creator>
		<pubDate>Sun, 06 Mar 2011 19:07:48 +0000</pubDate>
		<guid isPermaLink="false">https://sivajag.wordpress.com/?p=68#comment-240</guid>
		<description><![CDATA[Hey Siva,

Nice post! You may like to replace in the URL the text &quot;richhickey.github.com&quot; with &quot;clojure.github.com&quot; as the former is not being maintained anymore. I know it&#039;s easy to overlook - just a gentle reminder. :)

Regards,
Shantanu]]></description>
		<content:encoded><![CDATA[<p>Hey Siva,</p>
<p>Nice post! You may like to replace in the URL the text &#8220;richhickey.github.com&#8221; with &#8220;clojure.github.com&#8221; as the former is not being maintained anymore. I know it&#8217;s easy to overlook &#8211; just a gentle reminder. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Regards,<br />
Shantanu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Siva Jagadeesan</title>
		<link>http://techbehindtech.com/2010/06/25/parsing-xml-in-clojure/#comment-51</link>
		<dc:creator><![CDATA[Siva Jagadeesan]]></dc:creator>
		<pubDate>Thu, 26 Aug 2010 22:01:57 +0000</pubDate>
		<guid isPermaLink="false">https://sivajag.wordpress.com/?p=68#comment-51</guid>
		<description><![CDATA[Hi Scott:

zf/xml1 takes a location and set of predicates. 

From xml1 doc,

&quot;The loc is passed to the first predicate.  If the predicate returns
a collection, each value of the collection is passed to the next
predicate.  If it returns a location, the location is passed to the
next predicate.  If it returns true, the input location is passed to
the next predicate.  If it returns false or nil, the next predicate
is not called.

This process is repeated, passing the processed results of each
predicate to the next predicate.  xml-&gt; returns the final sequence.
The entire chain is evaluated lazily.

There are also special predicates: keywords are converted to tag=,
strings to text=, and vectors to sub-queries that return true if
they match.&quot;

In get-value function, we are creating location by
(zip/xml-zip (get-struct-map xml)))

and a set of predicates 

(conj (vec tags) zf/text))

When we do a conj we will have a vector of

[:person :name text-fn]

xml1-&gt; call processes keywords as a special predicate by converting them to tag= fn. tag= 
Usage: (tag= tagname)
Returns a query predicate that matches a node when its is a tag named tagname.

So when we pass the ROOT location, first (tag= :person) is called , which will return a PERSON location

Then PERSON location is called with (tag= :name) predicate, which will return NAME location.

To get the text from NAME location we use a build in predicate (text).

In get-value fn if you take out zf/text, you can see that it will return 

([{:tag :name, :attrs nil, :content [&quot;Siva&quot;]} {:l [], :pnodes [{:tag :friends, :attrs nil, :content [{:tag :person, :attrs nil, :content [{:tag :name, :attrs nil, :content [&quot;Siva&quot;]}]}]} {:tag :person, :attrs nil, :content [{:tag :name, :attrs nil, :content [&quot;Siva&quot;]}]}], :ppath {:l [], :pnodes [{:tag :friends, :attrs nil, :content [{:tag :person, :attrs nil, :content [{:tag :name, :attrs nil, :content [&quot;Siva&quot;]}]}]}], :ppath nil, :r nil}, :r nil}])

I hope I answered your question. Let me know if you it is still unclear.

regards,

-- Siva Jagadeesan]]></description>
		<content:encoded><![CDATA[<p>Hi Scott:</p>
<p>zf/xml1 takes a location and set of predicates. </p>
<p>From xml1 doc,</p>
<p>&#8220;The loc is passed to the first predicate.  If the predicate returns<br />
a collection, each value of the collection is passed to the next<br />
predicate.  If it returns a location, the location is passed to the<br />
next predicate.  If it returns true, the input location is passed to<br />
the next predicate.  If it returns false or nil, the next predicate<br />
is not called.</p>
<p>This process is repeated, passing the processed results of each<br />
predicate to the next predicate.  xml-&gt; returns the final sequence.<br />
The entire chain is evaluated lazily.</p>
<p>There are also special predicates: keywords are converted to tag=,<br />
strings to text=, and vectors to sub-queries that return true if<br />
they match.&#8221;</p>
<p>In get-value function, we are creating location by<br />
(zip/xml-zip (get-struct-map xml)))</p>
<p>and a set of predicates </p>
<p>(conj (vec tags) zf/text))</p>
<p>When we do a conj we will have a vector of</p>
<p>[:person :name text-fn]</p>
<p>xml1-&gt; call processes keywords as a special predicate by converting them to tag= fn. tag=<br />
Usage: (tag= tagname)<br />
Returns a query predicate that matches a node when its is a tag named tagname.</p>
<p>So when we pass the ROOT location, first (tag= :person) is called , which will return a PERSON location</p>
<p>Then PERSON location is called with (tag= :name) predicate, which will return NAME location.</p>
<p>To get the text from NAME location we use a build in predicate (text).</p>
<p>In get-value fn if you take out zf/text, you can see that it will return </p>
<p>([{:tag :name, :attrs nil, :content ["Siva"]} {:l [], :pnodes [{:tag :friends, :attrs nil, :content [{:tag :person, :attrs nil, :content [{:tag :name, :attrs nil, :content ["Siva"]}]}]} {:tag :person, :attrs nil, :content [{:tag :name, :attrs nil, :content ["Siva"]}]}], :ppath {:l [], :pnodes [{:tag :friends, :attrs nil, :content [{:tag :person, :attrs nil, :content [{:tag :name, :attrs nil, :content ["Siva"]}]}]}], :ppath nil, :r nil}, :r nil}])</p>
<p>I hope I answered your question. Let me know if you it is still unclear.</p>
<p>regards,</p>
<p>&#8211; Siva Jagadeesan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Hickey</title>
		<link>http://techbehindtech.com/2010/06/25/parsing-xml-in-clojure/#comment-50</link>
		<dc:creator><![CDATA[Scott Hickey]]></dc:creator>
		<pubDate>Thu, 26 Aug 2010 17:58:32 +0000</pubDate>
		<guid isPermaLink="false">https://sivajag.wordpress.com/?p=68#comment-50</guid>
		<description><![CDATA[Can you explain what&#039;s happening with apply zf/xml1-&gt; in the get value function? It looks like (conj (vec tags) zf/text) is building a list of functions to invoke but I don&#039;t see how this all comes together. Thanks.]]></description>
		<content:encoded><![CDATA[<p>Can you explain what&#8217;s happening with apply zf/xml1-&gt; in the get value function? It looks like (conj (vec tags) zf/text) is building a list of functions to invoke but I don&#8217;t see how this all comes together. Thanks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
