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.
(aggregate-xmlns xml)
Put all occurring xmlns into the root
Put all occurring xmlns into the root
(alias-ns & {:as alias-nss})
Define a clojure namespace alias for shortened keyword and symbol namespaces. Similar to clojure.core/alias, but if namespace doesn't exist, it is created.
(declare-ns :xml.dav "DAV:") (alias-ns :D :xml.dav) {:tag ::D/propfind :content []}
Define a clojure namespace alias for shortened keyword and symbol namespaces. Similar to clojure.core/alias, but if namespace doesn't exist, it is created. ## Example (declare-ns :xml.dav "DAV:") (alias-ns :D :xml.dav) {:tag ::D/propfind :content []}
(canonical-name n)
Put (q)name into canonical form as per ns-env
Put (q)name into canonical form as per ns-env
(declare-ns & {:as cljns-xmlnss})
Define mappings in the global keyword-ns -> qname-uri mapping table. Arguments are pairs of ns-name - qname-uri ns-name must be a string, symbol, keyword or clojure namespace. The canonical form is string. ns-uri must be a string
Define mappings in the global keyword-ns -> qname-uri mapping table. Arguments are pairs of ns-name - qname-uri ns-name must be a string, symbol, keyword or clojure namespace. The canonical form is string. ns-uri must be a string
(element tag)
(element tag attrs)
(element tag attrs & content)
Create an xml Element from content varargs
Create an xml Element from content varargs
(element* tag attrs content)
(element* tag attrs content meta)
Create an xml element from a content collection and optional metadata
Create an xml element from a content collection and optional metadata
(element-nss {:keys [attrs] :as element})
Get xmlns environment from element
Get xmlns environment from element
(emit e writer & {: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
(emit-str e & opts)
Emits the Element to String and returns it
Emits the Element to String and returns it
(event-seq source {: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 and supporting-external-entities false. :include-node? can be a set of #{:start-element :end-element :characters :comment}
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 and supporting-external-entities false. :include-node? can be a set of #{:start-element :end-element :characters :comment}
(find-xmlns xml)
Find all xmlns occuring in a root
Find all xmlns occuring in a root
(indent e writer & 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.
(indent-str e & opts)
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
(ns-uri ns)
Look up xmlns uri to keyword namespace
Look up xmlns uri to keyword namespace
(parse source & opts)
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.
(parse-str s & opts)
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.
(qname-local qname)
Get the name for this qname
Get the name for this qname
(qname-uri qname)
Get the namespace uri for this qname
Get the namespace uri for this qname
(sexp-as-element sexp)
Convert a single sexp into an Element
Convert a single sexp into an Element
(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.
(uri-ns uri)
Look up keyword namespace to xmlns uri
Look up keyword namespace to xmlns uri
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close