class Nokogiri::XML::Schema
def validate(input)
errors = schema.validate("/path/to/file.xml")
schema = Nokogiri::XML::Schema.new(File.read(XSD_FILE))
*Example:* Validate an \XML document on disk, and capture any errors that are found.
errors = schema.validate(document)
schema = Nokogiri::XML::Schema.new(File.read(XSD_FILE))
*Example:* Validate an existing XML::Document, and capture any errors that are found.
[Returns] Array
A parsed document, or a string containing a local filename.
- +input+ (Nokogiri::XML::Document | String)
[Parameters]
Validate +input+ and return any errors that are found.
:call-seq: validate(input) → Array
def validate(input) if input.is_a?(Nokogiri::XML::Document) validate_document(input) elsif File.file?(input) validate_file(input) else raise ArgumentError, "Must provide Nokogiri::XML::Document or the name of an existing file" end end