]> code.delx.au - gnu-emacs/blobdiff - lisp/nxml/nxml-parse.el
Update docs for `customize-mode'
[gnu-emacs] / lisp / nxml / nxml-parse.el
index bad7710a3d5d151422bad5cb0ff3b6554775df37..41b2e8ee513d87a38334b22cee45d5710902ad0a 100644 (file)
@@ -1,16 +1,16 @@
 ;;; nxml-parse.el --- XML parser, sharing infrastructure with nxml-mode
 
-;; Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
 
 ;; Author: James Clark
-;; Keywords: XML
+;; Keywords: wp, hypermedia, languages, XML
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,9 +18,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 (defvar nxml-parse-file-name nil)
 
 (defvar nxml-validate-function nil
-  "Nil or a function to be called by `nxml-parse-file' to perform validation.
+  "Either nil or a function called by `nxml-parse-file' to perform validation.
 The function will be called once for each start-tag or end-tag.  The
 function is passed two arguments TEXT and START-TAG.  For a start-tag,
 START-TAG is a list (NAME ATTRIBUTES) where NAME and ATTRIBUTES are in
-the same form as returned by `nxml-parse-file.  For an end-tag,
+the same form as returned by `nxml-parse-file'.  For an end-tag,
 START-TAG is nil.  TEXT is a string containing the text immediately
 preceding the tag, or nil if there was no such text.  An empty element
 is treated as a start-tag followed by an end-tag.
 
 For a start-tag, the namespace state will be the state after
-processing the namespace declarations in the start-tag. For an
+processing the namespace declarations in the start-tag.  For an
 end-tag, the namespace state will be the state before popping the
 namespace declarations for the corresponding start-tag.
 
@@ -77,7 +75,7 @@ An XML element is represented as a list (NAME ATTRIBUTES . CHILDREN).
 NAME is either a string, in the case where the name does not have a
 namespace, or a cons (NAMESPACE . LOCAL-NAME), where NAMESPACE is a
 symbol and LOCAL-NAME is a string, in the case where the name does
-have a namespace. NAMESPACE is a keyword whose name is `:URI', where
+have a namespace.  NAMESPACE is a keyword whose name is `:URI', where
 URI is the namespace name.  ATTRIBUTES is an alist of attributes where
 each attribute has the form (NAME . VALUE), where NAME has the same
 form as an element name, and VALUE is a string.  A namespace
@@ -90,31 +88,29 @@ list representing the document element.
 
 If the XML document is not well-formed, an error having the condition
 `nxml-file-parse-error' will be signaled; the error data will be a
-list of the \(FILE POSITION MESSAGE), where POSITION is an integer
-specifying the position where the error was detected, and MESSAGE is a
-string describing the error.
+list of the form \(FILE POSITION MESSAGE), where POSITION is an
+integer specifying the position where the error was detected, and
+MESSAGE is a string describing the error.
 
 The current contents of FILE will be parsed even if there is a
 modified buffer currently visiting FILE.
 
-If the variable `nxml-validation-function' is non-nil, it will be
-called twice for each element, and any reported error will be signaled
-in the same way as well-formedness error."
-  (save-excursion
-    (set-buffer (nxml-parse-find-file file))
+If the variable `nxml-validate-function' is non-nil, it will be called
+twice for each element, and any reported error will be signaled in the
+same way as well-formedness error."
+  (with-current-buffer (nxml-parse-find-file file)
     (unwind-protect
        (let ((nxml-parse-file-name file))
          (nxml-parse-instance))
       (kill-buffer nil))))
 
 (defun nxml-parse-find-file (file)
-  (save-excursion
-    (set-buffer (get-buffer-create " *nXML Parse*"))
+  (with-current-buffer (get-buffer-create " *nXML Parse*")
     (erase-buffer)
     (let ((set-auto-coding-function 'nxml-set-xml-coding))
       (insert-file-contents file))
     (current-buffer)))
-      
+
 (defun nxml-parse-instance ()
   (let (xmltok-dtd)
     (xmltok-save
@@ -308,7 +304,7 @@ in the same way as well-formedness error."
 (defun nxml-parse-error (position &rest args)
   (nxml-signal-file-parse-error nxml-parse-file-name
                                (or position xmltok-start)
-                               (apply 'format args)))
+                               (apply #'format-message args)))
 
 (defun nxml-check-xmltok-errors ()
   (when xmltok-errors
@@ -319,5 +315,4 @@ in the same way as well-formedness error."
 
 (provide 'nxml-parse)
 
-;; arch-tag: fc19639b-1bff-4673-9992-f539da89ba1e
 ;;; nxml-parse.el ends here