Function: xml-debug-print-internal
xml-debug-print-internal is a byte-compiled function defined in
xml.el.gz.
Signature
(xml-debug-print-internal XML INDENT-STRING)
Documentation
Outputs the XML tree in the current buffer.
The first line is indented with INDENT-STRING.
Source Code
;; Defined in /usr/src/emacs/lisp/xml.el.gz
(defun xml-debug-print-internal (xml indent-string)
"Outputs the XML tree in the current buffer.
The first line is indented with INDENT-STRING."
(let ((tree xml)
attlist)
(insert indent-string ?< (symbol-name (xml-node-name tree)))
;; output the attribute list
(setq attlist (xml-node-attributes tree))
(while attlist
(insert ?\ (symbol-name (caar attlist)) "=\""
(xml-escape-string (cdar attlist)) ?\")
(setq attlist (cdr attlist)))
(setq tree (xml-node-children tree))
(if (null tree)
(insert ?/ ?>)
(insert ?>)
;; output the children
(dolist (node tree)
(cond
((listp node)
(insert ?\n)
(xml-debug-print-internal node (concat indent-string " ")))
((stringp node)
(insert (xml-escape-string node)))
(t
(error "Invalid XML tree"))))
(when (not (and (null (cdr tree))
(stringp (car tree))))
(insert ?\n indent-string))
(insert ?< ?/ (symbol-name (xml-node-name xml)) ?>))))