xml/dom
src/xml/dom.tur
parse XML into a dom-core Document.
Since: 0.1.0
defn
dom-parse-string-opts
(dom-parse-string-opts [src : cstr opts : ParseOpts])
parse an in-memory document into a tree.
Parameters
| src | the document | |
| opts | limits and switches (see xml/sax ParseOpts) |
Returns
(Result Document ParseError) -- release the Document with `dom-free`.
Example
(dom-parse-string-opts src (with (default-parse-opts) [namespaces false]))
Since: 0.1.0
defn
dom-parse-string
(dom-parse-string [src : cstr] :)
parse an in-memory document with the safe defaults.
Parameters
| src | the document |
Returns
(Result Document ParseError)
Example
(match (dom-parse-string "<a><b>hi</b></a>")
(Ok d) (do (println (to-cstr (dom-serialize (dom-node d))))
(dom-free d))
(Err e) (println (parse-error-message e)))
Since: 0.1.0
defn
dom-parse-file-opts
(dom-parse-file-opts [path : cstr opts : ParseOpts])
parse a file into a tree, reading 64 KiB at a time.
Parameters
| path | the file | |
| opts | limits and switches |
Returns
(Result Document ParseError) -- an Io error when the file cannot be opened.
Example
(dom-parse-file-opts "sitemap.xml" (default-parse-opts))
Since: 0.1.0
defn
dom-parse-file
(dom-parse-file [path : cstr] :)
parse a file into a tree with the safe defaults.
Parameters
| path | the file |
Returns
(Result Document ParseError)
Example
(dom-parse-file "feed.xml")
Since: 0.1.0
Internal definitions
XmlDomRaw-- internal: the C parser state.__new-raw-- internal: allocate the C parser (NULL on OOM).__null?-- internal.__free-- internal.__set-string-- internal.__set-file-- internal: 0, or -1 with an Io error recorded.__run-- internal: build the tree; the turdom_doc or NULL.__err-kind-- internal.__err-msg-- internal.__err-line-- internal.__err-col-- internal.__kind-of-- internal: ParseErrorKind from its ordinal.__error-- internal: the recorded error (msg copied).__build-- internal: run a configured parser and wrap the outcome.__make-- internal: a C parser for these options, or none on OOM.__oom-- internal.