Function: xml-parse-file

xml-parse-file is an autoloaded and byte-compiled function defined in xml.el.gz.

Signature

(xml-parse-file FILE &optional PARSE-DTD PARSE-NS)

Documentation

Parse the well-formed XML file FILE.

Return the top node with all its children. If PARSE-DTD is non-nil, the DTD is parsed rather than skipped.

If PARSE-NS is non-nil, then QNAMES are expanded. By default, the variable xml-default-ns is the mapping from namespaces to URIs, and expanded names will be returned as a cons

  ("namespace:" . "foo").

If PARSE-NS is an alist, it will be used as the mapping from namespace to URIs instead.

If it is the symbol symbol-qnames, expanded names will be returned as a plain symbol namespace:foo instead of a cons.

Both features can be combined by providing a cons cell

  (symbol-qnames . ALIST).

Source Code

;; Defined in /usr/src/emacs/lisp/xml.el.gz
;;; Entry points:

;;;###autoload
(defun xml-parse-file (file &optional parse-dtd parse-ns)
  "Parse the well-formed XML file FILE.
Return the top node with all its children.
If PARSE-DTD is non-nil, the DTD is parsed rather than skipped.

If PARSE-NS is non-nil, then QNAMES are expanded.  By default,
the variable `xml-default-ns' is the mapping from namespaces to
URIs, and expanded names will be returned as a cons

  (\"namespace:\" . \"foo\").

If PARSE-NS is an alist, it will be used as the mapping from
namespace to URIs instead.

If it is the symbol `symbol-qnames', expanded names will be
returned as a plain symbol `namespace:foo' instead of a cons.

Both features can be combined by providing a cons cell

  (symbol-qnames . ALIST)."
  (with-temp-buffer
    (insert-file-contents file)
    (xml--parse-buffer parse-dtd parse-ns)))