Liking cljdoc? Tell your friends :D

riveted.core

A Clojure library for the fast processing of XML with VTD-XML.

A Clojure library for the fast processing of XML with VTD-XML.
raw docstring

atclj

(at navigator xpath)
(at navigator xpath prefix url)

Search for the given XPath in the navigator, returning the first matching navigator. If used with a namespace aware navigator, also takes a namespace prefix and URL for use in the XPath.

Examples:

; Returns a single navigator for the first matching element. (at nav "/article/title")

; Returns a single navigator for the first matching element providing ; ns-nav is namespace aware. (at ns-nav "//ns1:title" "ns1" "http://example.com/ns")

Search for the given XPath in the navigator, returning the first matching
navigator. If used with a namespace aware navigator, also takes a namespace
prefix and URL for use in the XPath.

Examples:

  ; Returns a single navigator for the first matching element.
  (at nav "/article/title")

  ; Returns a single navigator for the first matching element providing
  ; ns-nav is namespace aware.
  (at ns-nav "//ns1:title" "ns1" "http://example.com/ns")
sourceraw docstring

attrclj

(attr navigator attr-name)

Return the value of the named attribute for the given navigator. Attributes can be specified with either a keyword or string name.

Examples:

(attr (root nav) :lang) ;=> "en"

Return the value of the named attribute for the given navigator.
Attributes can be specified with either a keyword or string name.

Examples:

  (attr (root nav) :lang)
  ;=> "en"
sourceraw docstring

attr?clj

(attr? navigator attr-name)

Test whether the given attribute exists on the current element. Attributes can be specified with either a keyword or string name.

Examples:

(attr? (root nav) :lang) ;=> true

Test whether the given attribute exists on the current element.
Attributes can be specified with either a keyword or string name.

Examples:

  (attr? (root nav) :lang)
  ;=> true
sourceraw docstring

attribute?clj

(attribute? navigator)

Tests whether the given navigator is currently positioned on an attribute.

Tests whether the given navigator is currently positioned on an attribute.
sourceraw docstring

childrenclj

(children navigator)
(children navigator element)

Return a lazy sequence of navigators for all child nodes of the given navigator (optionally restricted by a given element type).

Examples:

; Return navigators for all children of nav. (children nav)

; Return navigators for all child p elements of nav. (children nav :p)

Return a lazy sequence of navigators for all child nodes of the given
navigator (optionally restricted by a given element type).

Examples:

  ; Return navigators for all children of nav.
  (children nav)

  ; Return navigators for all child p elements of nav.
  (children nav :p)
sourceraw docstring

document?clj

(document? navigator)

Tests whether the given navigator is currently positioned the document.

Tests whether the given navigator is currently positioned the document.
sourceraw docstring

element?clj

(element? navigator)

Tests whether the given navigator is currently positioned on an element.

Tests whether the given navigator is currently positioned on an element.
sourceraw docstring

first-childclj

(first-child navigator)
(first-child navigator element)

Return a new navigator pointing to the current element's first child element (restricted by an optional element type).

Examples:

; Return a new navigator pointing to the first child element of nav. (first-child nav)

; Return a new navigator pointing to the first child b element of nav. (first-child nav :b)

Return a new navigator pointing to the current element's first child element
(restricted by an optional element type).

Examples:

  ; Return a new navigator pointing to the first child element of nav.
  (first-child nav)

  ; Return a new navigator pointing to the first child b element of nav.
  (first-child nav :b)
sourceraw docstring

first-child!clj

(first-child! navigator)
(first-child! navigator element)

Move the given navigator to the current element's first child element (restricted by an optional element type), mutating it in place.

Examples:

; Move nav to the first child element. (first-child! nav)

; Move nav to the first child b element. (first-child! nav :b)

Move the given navigator to the current element's first child element
(restricted by an optional element type), mutating it in place.

Examples:

  ; Move nav to the first child element.
  (first-child! nav)

  ; Move nav to the first child b element.
  (first-child! nav :b)
sourceraw docstring

fragmentclj

(fragment navigator)

Return a string XML fragment for all nodes under the given navigator.

Examples:

(fragment nav) ;=> "<b>Some</b> XML as a raw <i>string</i>"

Return a string XML fragment for all nodes under the given navigator.

Examples:

  (fragment nav)
  ;=> "<b>Some</b> XML as a raw <i>string</i>"
sourceraw docstring

last-childclj

(last-child navigator)
(last-child navigator element)

Return a new navigator pointing to the current element's last child element (restricted by an optional element type).

Examples:

; Return a new navigator pointing to the last child element of nav. (last-child nav)

; Return a new navigator pointing to the last child b element of nav. (last-child nav :b)

Return a new navigator pointing to the current element's last child element
(restricted by an optional element type).

Examples:

  ; Return a new navigator pointing to the last child element of nav.
  (last-child nav)

  ; Return a new navigator pointing to the last child b element of nav.
  (last-child nav :b)
sourceraw docstring

last-child!clj

(last-child! navigator)
(last-child! navigator element)

Move the given navigator to the current element's last child element (restricted by an optional element type), mutating it in place.

Examples:

; Move nav to the last child element. (last-child! nav)

; Move nav to the last child b element. (last-child! nav :b)

Move the given navigator to the current element's last child element
(restricted by an optional element type), mutating it in place.

Examples:

  ; Move nav to the last child element.
  (last-child! nav)

  ; Move nav to the last child b element.
  (last-child! nav :b)
sourceraw docstring

(navigator xml)
(navigator xml namespace-aware)

Return a VTD navigator for the given UTF-8 XML string with optional namespace support. If called with only a string of XML, namespace support is disabled.

Examples:

; Return a navigator for the given string with no namespace support. (navigator "<root><foo>Bar</foo></root>")

; Return a navigator for the given string with namespace support. (navigator "<root xmlns:ns="http://example.com/ns"><foo>Bar</foo></root>" true)

Return a VTD navigator for the given UTF-8 XML string with optional
namespace support. If called with only a string of XML, namespace support is
disabled.

Examples:

  ; Return a navigator for the given string with no namespace support.
  (navigator "<root><foo>Bar</foo></root>")

  ; Return a navigator for the given string with namespace support.
  (navigator "<root xmlns:ns=\"http://example.com/ns\"><foo>Bar</foo></root>" true)
sourceraw docstring

next-siblingclj

(next-sibling navigator)
(next-sibling navigator element)

Return a new navigator pointing to the current element's next sibling element (restricted by an optional element type).

Examples:

; Return a new navigator pointing to the next sibling element of nav. (next-sibling nav)

; Return a new navigator pointing to the next sibling b element of nav. (next-sibling nav :b)

Return a new navigator pointing to the current element's next sibling element
(restricted by an optional element type).

Examples:

  ; Return a new navigator pointing to the next sibling element of nav.
  (next-sibling nav)

  ; Return a new navigator pointing to the next sibling b element of nav.
  (next-sibling nav :b)
sourceraw docstring

next-sibling!clj

(next-sibling! navigator)
(next-sibling! navigator element)

Move the given navigator to the current element's next sibling element (restricted by an optional element type), mutating it in place.

Examples:

; Move nav to the next sibling element. (next-sibling! nav)

; Move nav to the next sibling b element. (next-sibling! nav :b)

Move the given navigator to the current element's next sibling element
(restricted by an optional element type), mutating it in place.

Examples:

  ; Move nav to the next sibling element.
  (next-sibling! nav)

  ; Move nav to the next sibling b element.
  (next-sibling! nav :b)
sourceraw docstring

next-siblingsclj

(next-siblings navigator)
(next-siblings navigator element)

Return a lazy sequence of navigators representing all siblings next to the given navigator (optionally restricted by a given element type).

Examples:

; Return navigators for every next sibling element to nav. (next-siblings nav)

; Return navigators for every next sibling p element to nav. (next-siblings nav :p)

Return a lazy sequence of navigators representing all siblings next to the
given navigator (optionally restricted by a given element type).

Examples:

  ; Return navigators for every next sibling element to nav.
  (next-siblings nav)

  ; Return navigators for every next sibling p element to nav.
  (next-siblings nav :p)
sourceraw docstring

parentclj

(parent navigator)

Return a new navigator pointing to the parent element of the given navigator.

Return a new navigator pointing to the parent element of the given
navigator.
sourceraw docstring

parent!clj

(parent! navigator)

Move the given navigator to the current element's parent element, mutating it in place.

Move the given navigator to the current element's parent element, mutating
it in place.
sourceraw docstring

previous-siblingclj

(previous-sibling navigator)
(previous-sibling navigator element)

Return a new navigator pointing to the current element's previous sibling element (restricted by an optional element type).

Examples:

; Return a new navigator pointing to the previous sibling element of nav. (previous-sibling nav)

; Return a new navigator pointing to the previous sibling b element of nav. (previous-sibling nav :b)

Return a new navigator pointing to the current element's previous sibling
element (restricted by an optional element type).

Examples:

  ; Return a new navigator pointing to the previous sibling element of nav.
  (previous-sibling nav)

  ; Return a new navigator pointing to the previous sibling b element of nav.
  (previous-sibling nav :b)
sourceraw docstring

previous-sibling!clj

(previous-sibling! navigator)
(previous-sibling! navigator element)

Move the given navigator to the current element's previous sibling element (restricted by an optional element type), mutating it in place.

Examples:

; Move nav to the previous sibling element. (previous-sibling! nav)

; Move nav to the previous sibling b element. (previous-sibling! nav :b)

Move the given navigator to the current element's previous sibling element
(restricted by an optional element type), mutating it in place.

Examples:

  ; Move nav to the previous sibling element.
  (previous-sibling! nav)

  ; Move nav to the previous sibling b element.
  (previous-sibling! nav :b)
sourceraw docstring

previous-siblingsclj

(previous-siblings navigator)
(previous-siblings navigator element)

Return a lazy sequence of navigators representing all siblings previous to the given navigator (optionally restricted by a given element type).

Note that this is lazily evaluated right-to-left so the final sequence will be in reverse order to the actual nodes in the document.

Examples:

; Return navigators for every previous sibling element to nav. (previous-siblings nav)

; Return navigators for every previous sibling p element to nav. (previous-siblings nav :p)

Return a lazy sequence of navigators representing all siblings previous to
the given navigator (optionally restricted by a given element type).

Note that this is lazily evaluated right-to-left so the final sequence will
be in reverse order to the actual nodes in the document.

Examples:

  ; Return navigators for every previous sibling element to nav.
  (previous-siblings nav)

  ; Return navigators for every previous sibling p element to nav.
  (previous-siblings nav :p)
sourceraw docstring

rootclj

(root navigator)

Return a new navigator pointing to the document root.

Return a new navigator pointing to the document root.
sourceraw docstring

root!clj

(root! navigator)

Move the given navigator to the document root, mutating it in place.

Move the given navigator to the document root, mutating it in place.
sourceraw docstring

(search navigator xpath)
(search navigator xpath prefix url)

Search for the given XPath in the navigator, returning a lazy sequence of all matching navigators. If used with a namespace aware navigator, also takes a namespace prefix and URL for use in the XPath.

Examples:

; Returns navigators for all matching elements. (search nav "/article/title")

; Returns navigators for all matching elements providing ns-nav is ; namespace aware. (search ns-nav "//ns1:title" "ns1" "http://example.com/ns")

Search for the given XPath in the navigator, returning a lazy sequence of all
matching navigators. If used with a namespace aware navigator, also takes
a namespace prefix and URL for use in the XPath.

Examples:

  ; Returns navigators for all matching elements.
  (search nav "/article/title")

  ; Returns navigators for all matching elements providing ns-nav is
  ; namespace aware.
  (search ns-nav "//ns1:title" "ns1" "http://example.com/ns")
sourceraw docstring

selectclj

(select navigator element)

Return a lazy sequence of navigators matching the given element name, * can be used to match all elements.

Examples:

; Returns navigators for each element in nav. (select nav "*")

; Returns navigators for all b elements in nav. (select nav "b")

Return a lazy sequence of navigators matching the given element name, * can
be used to match all elements.

Examples:

  ; Returns navigators for each element in nav.
  (select nav "*")

  ; Returns navigators for all b elements in nav.
  (select nav "b")
sourceraw docstring

siblingsclj

(siblings navigator)
(siblings navigator element)

Return navigators for all siblings to the given navigator (optionally restricted by a given element type).

Note that this is not lazy in order to preserve the correct order of nodes and previous siblings need to be fully realised for sorting.

Examples:

; Return navigators for all siblings to nav. (siblings nav)

; Return navigators for all sibling p elements to nav. (siblings nav :p)

Return navigators for all siblings to the given navigator (optionally
restricted by a given element type).

Note that this is not lazy in order to preserve the correct order of nodes
and previous siblings need to be fully realised for sorting.

Examples:

  ; Return navigators for all siblings to nav.
  (siblings nav)

  ; Return navigators for all sibling p elements to nav.
  (siblings nav :p)
sourceraw docstring

tagclj

(tag navigator)

Return the tag name for the element under the given VTD navigator as a string. If positioned on an attribute (e.g. with an XPath like /@foo), return the name of the attribute.

Examples:

(tag (root nav)) ;=> "root"

(tag (at nav "/channel/@id")) ;=> "id"

Return the tag name for the element under the given VTD navigator as a
string. If positioned on an attribute (e.g. with an XPath like /@foo), return
the name of the attribute.

Examples:

  (tag (root nav))
  ;=> "root"

  (tag (at nav "/channel/@id"))
  ;=> "id"
sourceraw docstring

textclj

(text navigator)

Return all descendant text content below the given navigator as one string. This means both the value of a simple text node and also the resulting text value of a mixed content node such as <p><b>Foo</b> bar</p>. If the navigator is currently positioned on an attribute (e.g. by using an XPath like /@foo), return the value of the attribute.

Examples:

; Returns "Foo" given nav points to <p>Foo</p> (text nav)

; Returns "Foo bar" given nav points to <p><b>Foo</b> bar</p> (text nav)

; Returns "123" given nav points to @src of <img src="123"/> (text nav)

Return all descendant text content below the given navigator as one string.
This means both the value of a simple text node and also the resulting text
value of a mixed content node such as <p><b>Foo</b> bar</p>. If the navigator
is currently positioned on an attribute (e.g. by using an XPath like /@foo),
return the value of the attribute.

Examples:

  ; Returns "Foo" given nav points to <p>Foo</p>
  (text nav)

  ; Returns "Foo bar" given nav points to <p><b>Foo</b> bar</p>
  (text nav)

  ; Returns "123" given nav points to @src of <img src="123"/>
  (text nav)
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close