Liking cljdoc? Tell your friends :D

clojure.data.xml

Functions to parse XML into lazy sequences and lazy trees and emit these as text.

Functions to parse XML into lazy sequences and lazy trees and
emit these as text.
raw docstring

AsElementscljprotocol

as-elementsclj

(as-elements expr)

Return a seq of elements represented by an expression.

Return a seq of elements represented by an expression.
source

cdataclj

(cdata content)
source

check-stream-encodingclj

(check-stream-encoding stream xml-encoding)
source

elementclj

(element tag & [attrs & content])
source

emitclj

(emit e stream & {:as opts})

Prints the given Element tree as XML text to stream. Options: :encoding <str> Character encoding to use

Prints the given Element tree as XML text to stream.
Options:
 :encoding <str>          Character encoding to use
sourceraw docstring

emit-cdataclj

(emit-cdata cdata-str writer)
source

emit-eventclj

(emit-event event writer)
source

emit-start-tagclj

(emit-start-tag event writer)
source

emit-strclj

(emit-str e)

Emits the Element to String and returns it

Emits the Element to String and returns it
sourceraw docstring

eventclj

(event type name & [attrs str])
source

event-treeclj

(event-tree events)

Returns a lazy tree of Element objects for the given seq of Event objects. See source-seq and parse.

Returns a lazy tree of Element objects for the given seq of Event
objects. See source-seq and parse.
sourceraw docstring

EventGenerationcljprotocol

Protocol for generating new events based on element type

Protocol for generating new events based on element type

gen-eventclj

(gen-event item)

Function to generate an event for e.

Function to generate an event for e.

next-eventsclj

(next-events item next-items)

Returns the next set of events that should occur after e. next-events are the events that should be generated after this one is complete.

Returns the next set of events that should occur after e.  next-events are the
events that should be generated after this one is complete.
sourceraw docstring

flatten-elementsclj

(flatten-elements elements)
source

indentclj

(indent e stream & {:as opts})

Emits the XML and indents the result. WARNING: this is slow it will emit the XML and read it in again to indent it. Intended for debugging/testing only.

Emits the XML and indents the result.  WARNING: this is slow
it will emit the XML and read it in again to indent it.  Intended for 
debugging/testing only.
sourceraw docstring

indent-strclj

(indent-str e)

Emits the XML and indents the result. Writes the results to a String and returns it

Emits the XML and indents the result.  Writes the results to a String and returns it
sourceraw docstring

indenting-transformerclj

(indenting-transformer)
source

parseclj

(parse source & props)

Parses the source, which can be an InputStream or Reader, and returns a lazy tree of Element records. Accepts key pairs with XMLInputFactory options, see http://docs.oracle.com/javase/6/docs/api/javax/xml/stream/XMLInputFactory.html and xml-input-factory-props for more information. Defaults coalescing true.

Parses the source, which can be an
InputStream or Reader, and returns a lazy tree of Element records. Accepts key pairs
with XMLInputFactory options, see http://docs.oracle.com/javase/6/docs/api/javax/xml/stream/XMLInputFactory.html
and xml-input-factory-props for more information. Defaults coalescing true.
sourceraw docstring

parse-strclj

(parse-str s & props)

Parses the passed in string to Clojure data structures. Accepts key pairs with XMLInputFactory options, see http://docs.oracle.com/javase/6/docs/api/javax/xml/stream/XMLInputFactory.html and xml-input-factory-props for more information. Defaults coalescing true.

Parses the passed in string to Clojure data structures.  Accepts key pairs
with XMLInputFactory options, see http://docs.oracle.com/javase/6/docs/api/javax/xml/stream/XMLInputFactory.html
and xml-input-factory-props for more information. Defaults coalescing true.
sourceraw docstring

qualified-nameclj

(qualified-name event-name)
source

seq-treeclj

(seq-tree parent exit? node coll)

Takes a seq of events that logically represents a tree by each event being one of: enter-sub-tree event, exit-sub-tree event, or node event.

Returns a lazy sequence whose first element is a sequence of sub-trees and whose remaining elements are events that are not siblings or descendants of the initial event.

The given exit? function must return true for any exit-sub-tree event. parent must be a function of two arguments: the first is an event, the second a sequence of nodes or subtrees that are children of the event. parent must return nil or false if the event is not an enter-sub-tree event. Any other return value will become a sub-tree of the output tree and should normally contain in some way the children passed as the second arg. The node function is called with a single event arg on every event that is neither parent nor exit, and its return value will become a node of the output tree.

(seq-tree #(when (= %1 :<) (vector %2)) #{:>} str [1 2 :< 3 :< 4 :> :> 5 :> 6]) ;=> (("1" "2" [("3" [("4")])] "5") 6)

Takes a seq of events that logically represents
a tree by each event being one of: enter-sub-tree event,
exit-sub-tree event, or node event.

Returns a lazy sequence whose first element is a sequence of
sub-trees and whose remaining elements are events that are not
siblings or descendants of the initial event.

The given exit? function must return true for any exit-sub-tree
event.  parent must be a function of two arguments: the first is an
event, the second a sequence of nodes or subtrees that are children
of the event.  parent must return nil or false if the event is not
an enter-sub-tree event.  Any other return value will become
a sub-tree of the output tree and should normally contain in some
way the children passed as the second arg.  The node function is
called with a single event arg on every event that is neither parent
nor exit, and its return value will become a node of the output tree.

(seq-tree #(when (= %1 :<) (vector %2)) #{:>} str
          [1 2 :< 3 :< 4 :> :> 5 :> 6])
;=> (("1" "2" [("3" [("4")])] "5") 6)
sourceraw docstring

sexp-as-elementclj

(sexp-as-element sexp)

Convert a single sexp into an Element

Convert a single sexp into an Element
sourceraw docstring

sexp-elementclj

(sexp-element tag attrs child)
source

sexps-as-fragmentclj

(sexps-as-fragment)
(sexps-as-fragment sexp)
(sexps-as-fragment sexp & sexps)

Convert a compact prxml/hiccup-style data structure into the more formal tag/attrs/content format. A seq of elements will be returned, which may not be suitable for immediate use as there is no root element. See also sexp-as-element.

The format is [:tag-name attr-map? content*]. Each vector opens a new tag; seqs do not open new tags, and are just used for inserting groups of elements into the parent tag. A bare keyword not in a vector creates an empty element.

To provide XML conversion for your own data types, extend the AsElements protocol to them.

Convert a compact prxml/hiccup-style data structure into the more formal
tag/attrs/content format. A seq of elements will be returned, which may
not be suitable for immediate use as there is no root element. See also
sexp-as-element.

The format is [:tag-name attr-map? content*]. Each vector opens a new tag;
seqs do not open new tags, and are just used for inserting groups of elements
into the parent tag. A bare keyword not in a vector creates an empty element.

To provide XML conversion for your own data types, extend the AsElements
protocol to them.
sourceraw docstring

source-seqclj

(source-seq s & {:as props})

Parses the XML InputSource source using a pull-parser. Returns a lazy sequence of Event records. Accepts key pairs with XMLInputFactory options, see http://docs.oracle.com/javase/6/docs/api/javax/xml/stream/XMLInputFactory.html and xml-input-factory-props for more information. Defaults coalescing true.

Parses the XML InputSource source using a pull-parser. Returns
a lazy sequence of Event records.  Accepts key pairs
with XMLInputFactory options, see http://docs.oracle.com/javase/6/docs/api/javax/xml/stream/XMLInputFactory.html
and xml-input-factory-props for more information. Defaults coalescing true.
sourceraw docstring

str-empty?clj

(str-empty? s)
source

write-attributesclj

(write-attributes attrs writer)
source

xml-commentclj

(xml-comment content)
source

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

× close