-;; Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2013 Free Software Foundation, Inc.
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 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
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
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
end-tag, the namespace state will be the state before popping the
namespace declarations for the corresponding start-tag.
end-tag, the namespace state will be the state before popping the
namespace declarations for the corresponding start-tag.
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
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
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
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
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
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.
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)