XML::Validate::Base3pm
Abstract base class to be used by xml::validate modules
Usage
use XML::Validate::Base;sub new {... override new ...}sub validate {... override validate ...}
Overview
XML::Validate::Base provides a base class with helpful subs for real XML::Validate modules.
Methods
- new(%options)
-
Constructs a new validator. This method must be overridden.
- validate($xml)
-
Parses and validates
$xml. Returns a true value on success, undef on failure. This method must be overridden.
- options
-
An accessor for the options hashref.
- set_options($supplied_options,$valid_options)
-
Sets the options for the validator.
$supplied_optionsand$valid_optionsare hash refs containing respectively the options supplied to the constructor and the valid options for validator along with their default values.If the supplied options hash ref contains an option not listed in valid options, this sub throws an exception.
- last_error
-
Returns the error from the last validate call. This is a hash ref with the following fields:
- •
-
message
- •
-
line
- •
-
column
Note that the error gets cleared at the beginning of each
"validate"call.
- add_error($error)
-
Stores
$errorfor retrieval by last_error.$errorshould be a hash ref.
- clear_errors
-
Clears any errors held by the validator.
Version
$Revision: 1.9 $ on $Date: 2005/09/06 11:05:08 $ by $Author: johna $
Releases
6 releases since Debian 6.0 (Squeeze); the text changed 2 times.