Function: xml-maybe-do-ns
xml-maybe-do-ns is a byte-compiled function defined in xml.el.gz.
Signature
(xml-maybe-do-ns NAME DEFAULT XML-NS)
Documentation
Perform any namespace expansion.
NAME is the name to perform the expansion on. DEFAULT is the default namespace. XML-NS is a cons of namespace names to uris. When namespace-aware parsing is off, then XML-NS is nil.
During namespace-aware parsing, any name without a namespace is put into the namespace identified by DEFAULT. nil is used to specify that the name shouldn't be given a namespace. Expanded names will by default be returned as a cons. If you would like to get plain symbols instead, provide a cons cell
(symbol-qnames . ALIST)
in the XML-NS argument.
Source Code
;; Defined in /usr/src/emacs/lisp/xml.el.gz
(defun xml-maybe-do-ns (name default xml-ns)
"Perform any namespace expansion.
NAME is the name to perform the expansion on.
DEFAULT is the default namespace. XML-NS is a cons of namespace
names to uris. When namespace-aware parsing is off, then XML-NS
is nil.
During namespace-aware parsing, any name without a namespace is
put into the namespace identified by DEFAULT. nil is used to
specify that the name shouldn't be given a namespace.
Expanded names will by default be returned as a cons. If you
would like to get plain symbols instead, provide a cons cell
(symbol-qnames . ALIST)
in the XML-NS argument."
(if (consp xml-ns)
(let* ((symbol-qnames (eq (car-safe xml-ns) 'symbol-qnames))
(nsp (string-match ":" name))
(lname (if nsp (substring name (match-end 0)) name))
(prefix (if nsp (substring name 0 (match-beginning 0)) default))
(special (and (string-equal lname "xmlns") (not prefix)))
;; Setting default to nil will insure that there is not
;; matching cons in xml-ns. In which case we
(ns (or (cdr (assoc (if special "xmlns" prefix)
(if symbol-qnames (cdr xml-ns) xml-ns)))
"")))
(if (and symbol-qnames
(not special)
(not (string= prefix "xmlns")))
(intern (concat ns lname))
(cons ns (if special "" lname))))
(intern name)))