• (parse-trim s)
  • (parse-trim s startparse queue-size)
Parses the source s, which can be a File, InputStream or String
naming a URI. Returns a lazy tree of the clojure.xml/element
struct-map, which has the keys :tag, :attrs, and :content and
accessor fns tag, attrs, and content, with the whitespace trimmed
from around each content string. This format is compatible with what
clojure.xml/parse produces, except :content is a lazy seq instead of
a vector. Other SAX-compatible parsers can be supplied by passing
startparse, a fn taking a source and a ContentHandler and returning
a parser. If a parser is specified, it will be run in a separate
thread and be allowed to get ahead by queue-size items, which
defaults to maxing. If no parser is specified and
org.xmlpull.v1.XmlPullParser is in the classpath, this superior pull
parser will be used.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/lazy_xml.clj:95 top

(defn parse-trim
  "Parses the source s, which can be a File, InputStream or String
  naming a URI. Returns a lazy tree of the clojure.xml/element
  struct-map, which has the keys :tag, :attrs, and :content and
  accessor fns tag, attrs, and content, with the whitespace trimmed
  from around each content string. This format is compatible with what
  clojure.xml/parse produces, except :content is a lazy seq instead of
  a vector.  Other SAX-compatible parsers can be supplied by passing
  startparse, a fn taking a source and a ContentHandler and returning
  a parser. If a parser is specified, it will be run in a separate
  thread and be allowed to get ahead by queue-size items, which
  defaults to maxing.  If no parser is specified and
  org.xmlpull.v1.XmlPullParser is in the classpath, this superior pull
  parser will be used."
  ([s] (first (mktree (parse-seq s))))
  ([s startparse queue-size]
    (first (mktree (parse-seq s startparse queue-size)))))
Vars in clojure.contrib.lazy-xml/parse-trim: defn first
Used in 0 other vars

Comments top

No comments for parse-trim. Log in to add a comment.