Skip to content

Instantly share code, notes, and snippets.

@boxxxie
Created February 6, 2013 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boxxxie/4720053 to your computer and use it in GitHub Desktop.
Save boxxxie/4720053 to your computer and use it in GitHub Desktop.
how would i eliminate the duplicate xml traversals by reusing common zipper locations? tried saving (xml-> parsed-page :Items :Item :Facets :Facet) and reusing that in the sub-categories traversal, but got errors
(let [parsed-page (cxml/parse-string (emit-cxml-from-pages
[page1-mock]
"IMGBASE-STRING"
"whatever name"))
header-cat-names (xml-> parsed-page :FacetCategories :FacetCategory (attr :Name))
categories (set (xml-> parsed-page :Items :Item :Facets :Facet (attr :Name)))
sub-categories (set (xml-> parsed-page :Items :Item :Facets :Facet :String (attr :Value)))
collection-attrs #spy/d(->> t first :attrs keys set)
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment