Validates an xmltv file
Utility library that validates that a file is correct according to http://wiki.xmltv.org/index.php/XMLTVFormat.
All these functions are exported on demand.
Load the xmltv dtd. Takes a single parameter which is the name of the xmltv dtd file. LoadDtd must be called before ValidateFile can be called.
Validate that a file is valid according to the \s-1XMLTV\s0 dtd and try to check that it contains valid information. ValidateFile takes a filename as parameter and optionally also a day and an offset and prints error messages to \s-1STDERR\s0. ValidateFile returns a list of errors that it found with the file. Each error takes the form of a keyword: ValidateFile checks the following:
The file is not well-formed \s-1XML\s0.
The file does not follow the \s-1XMLTV\s0 \s-1DTD\s0.
No channel-entry found for a channelid that is used in a programme-entry.
More than one channel-entry found for a channelid.
No programme entries were found in the file.
There are no programme entries for one of the channels listed with a channel-entry.
An xmltvid does not look like a proper id, i.e. it does not match /^[-a-zA-Z0-9]+(\.[-a-zA-Z0-9]+)+$/.
A programme-entry without an id was found.
A programme entry with an empty or missing title was found.
A programme entry with an empty desc-element was found. The desc-element shall be omitted if there is no description.
A programme entry with an invalid start-time was found.
A programme entry with an invalid stop-time was found.
A programme entry with an invalid episode number was found.
The file is encoded in iso-8859 but contains characters that have no meaning in iso-8859 (or are control characters). If it's iso-8859-1 aka Latin 1 it might be some characters in windows-1252 encoding.
The file is encoded in utf-8 but contains characters that look strange. 1) Mis-encoded single characters represented with [\s-1EF\s0][\s-1BF\s0][\s-1BD\s0] bytes 2) Mis-encoded single characters represented with [C3][\s-1AF\s0][C2][\s-1BF\s0][C2][\s-1BD\s0] bytes 3) Mis-encoded single characters in range [C2][80-9F]
If no errors are found, an empty list is returned.
It is currently necessary to specify the path to the xmltv dtd-file. This should not be necessary.
Copyright (C) 2006 Mattias Holmlund.
This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the \s-1GNU\s0 General Public License for more details.
You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, \s-1MA\s0 02110-1301, \s-1USA\s0.