Named repairs for the text of a feed that isn't well-formed XML, applied only when the strict parse fails, and always reported.
Every repair has an id, each use of one goes into a report, and the option :except leaves out those that it names.
Named repairs for the text of a feed that isn't well-formed XML, applied only when the strict parse fails, and always reported. Every repair has an id, each use of one goes into a report, and the option :except leaves out those that it names.
(declare-known-prefixes s)The string s with every undeclared prefix that names one of the known
namespaces declared on its root element.
The string `s` with every undeclared prefix that names one of the known namespaces declared on its root element.
(escape-bare-ampersands s)The string s with every ampersand outside CDATA that doesn't start a
reference escaped.
The string `s` with every ampersand outside CDATA that doesn't start a reference escaped.
(parse-raw xml)(parse-raw xml opts)Parse the XML document xml into its raw tree, and repair it first
when it's malformed, except by the repairs that the :except of opts
names. It returns a map of the :raw tree and the :report of the repairs.
The xml is a string or, on the JVM, an InputStream or a Reader. The
strict parse comes first, so a well-formed document has an empty
report. When the repairs aren't enough, a lenient parser reads the
document if there is one, and else the error of the strict parse is
thrown.
The lenient parser is the :lenient-parser of opts, or else jsoup on
the JVM when it's on the classpath. ClojureScript has none of its own,
so give it one there, e.g. over htmlparser2. It's a function of the
XML text that returns its raw Hiccup, as qname-hiccup's parse-raw does:
elements as vectors of the name as written, a map of the attributes,
and the children, with the namespace declarations as attributes, e.g.
["rss" {"xmlns:itunes" "http://www.itunes.com/dtds/podcast-1.0.dtd"}
["channel" {} ["itunes:author" {} "Ann"]]]
Parse the XML document `xml` into its raw tree, and repair it first
when it's malformed, except by the repairs that the :except of `opts`
names. It returns a map of the :raw tree and the :report of the repairs.
The `xml` is a string or, on the JVM, an InputStream or a Reader. The
strict parse comes first, so a well-formed document has an empty
report. When the repairs aren't enough, a lenient parser reads the
document if there is one, and else the error of the strict parse is
thrown.
The lenient parser is the :lenient-parser of `opts`, or else jsoup on
the JVM when it's on the classpath. ClojureScript has none of its own,
so give it one there, e.g. over htmlparser2. It's a function of the
XML text that returns its raw Hiccup, as qname-hiccup's parse-raw does:
elements as vectors of the name as written, a map of the attributes,
and the children, with the namespace declarations as attributes, e.g.
["rss" {"xmlns:itunes" "http://www.itunes.com/dtds/podcast-1.0.dtd"}
["channel" {} ["itunes:author" {} "Ann"]]](repair s)(repair s {:keys [except] :or {except #{}} :as opts})Apply every repair to the XML text s, except those whose ids the
:except of opts names.
It returns a map of the :xml and a :report, with a diagnostic for each repair that changed something.
Apply every repair to the XML text `s`, except those whose ids the :except of `opts` names. It returns a map of the :xml and a :report, with a diagnostic for each repair that changed something.
The text repairs, in the order that they're applied.
The text repairs, in the order that they're applied.
(replace-html-entities s)The string s with its HTML entities outside CDATA replaced by numeric
references, which XML understands. Unknown named entities become literal
text.
The string `s` with its HTML entities outside CDATA replaced by numeric references, which XML understands. Unknown named entities become literal text.
(strip-control-characters s)The string s without the control characters that XML 1.0 forbids, and
without the character references to them outside CDATA, which XML
forbids too.
The string `s` without the control characters that XML 1.0 forbids, and without the character references to them outside CDATA, which XML forbids too.
(strip-leading-junk s)The string s without anything before the XML declaration or the rss
start tag, whichever comes first, or else before its first tag.
That's byte order marks, blank lines and stray output of the server, such as a PHP warning.
The string `s` without anything before the XML declaration or the rss start tag, whichever comes first, or else before its first tag. That's byte order marks, blank lines and stray output of the server, such as a PHP warning.
(strip-trailing-junk s)The string s without anything but whitespace after the rss end tag,
which is stray output of the server, such as a PHP warning.
The string `s` without anything but whitespace after the rss end tag, which is stray output of the server, such as a PHP warning.
(undeclared-prefixes s)The namespace prefixes that the tags and attributes in s use without
an xmlns: declaration, looked for in the start tags alone.
The namespace prefixes that the tags and attributes in `s` use without an xmlns: declaration, looked for in the start tags alone.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |