Variable: nxml-validate-function
nxml-validate-function is a variable defined in nxml-parse.el.gz.
Value
nil
Documentation
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,
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 end-tag, the namespace state will be the state before popping the namespace declarations for the corresponding start-tag.
The function must return nil if no error is detected or a cons (MESSAGE . LOCATION) where MESSAGE is a string containing an error message and LOCATION indicates what caused the error as follows:
- nil indicates the tag as whole caused it; this is always allowed;
- text indicates the text caused it; this is allowed only if
TEXT is non-nil;
- tag-close indicates the close of the tag caused it; this is
allowed only if START-TAG is non-nil;
- (attribute-name . N) indicates that the name of the Nth attribute
caused it; N counts from 0; this is allowed only if START-TAG is non-nil
and N must be less than the number of attributes;
- (attribute-value . N) indicates that the value of the Nth attribute
caused it; N counts from 0; this is allowed only if START-TAG is non-nil
and N must be less than the number of attributes.
Source Code
;; Defined in /usr/src/emacs/lisp/nxml/nxml-parse.el.gz
(defvar nxml-validate-function nil
"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,
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
end-tag, the namespace state will be the state before popping the
namespace declarations for the corresponding start-tag.
The function must return nil if no error is detected or a
cons (MESSAGE . LOCATION) where MESSAGE is a string containing
an error message and LOCATION indicates what caused the error
as follows:
- nil indicates the tag as whole caused it; this is always allowed;
- text indicates the text caused it; this is allowed only if
TEXT is non-nil;
- tag-close indicates the close of the tag caused it; this is
allowed only if START-TAG is non-nil;
- (attribute-name . N) indicates that the name of the Nth attribute
caused it; N counts from 0; this is allowed only if START-TAG is non-nil
and N must be less than the number of attributes;
- (attribute-value . N) indicates that the value of the Nth attribute
caused it; N counts from 0; this is allowed only if START-TAG is non-nil
and N must be less than the number of attributes.")