ValidateFile(3pm)
π NAME π
XMLTV::ValidateFile β bestie, this is the little Perl library that validates an XMLTV file. It lives in the User Contributed Perl Documentation corner of ValidateFile(3pm) and it is lowkey a vibe check for your XML. β¨
πΈ DESCRIPTION πΈ
It's a utility library. What does it do? It validates that a file is correct according to http://wiki.xmltv.org/index.php/XMLTVFormat. That's it, that's the whole job, and it does it so well. π
π EXPORTED FUNCTIONS π
Okay so listen. All these functions are exported on demand. Not automatic, not by default β on demand, bestie.
LoadDtd π¦
Loads the xmltv dtd. Takes a single parameter, which is the name of the xmltv dtd file.
π¨ REAL TALK:LoadDtdmust be called beforeValidateFilecan be called. No shortcuts, no skipping. It's giving prerequisites, periodt.
ValidateFile π
Validates that a file is valid according to the XMLTV dtd, and also tries 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 STDERR.
ValidateFile returns a list of errors that it found with the file. Each error takes the form of a keyword:
ValidateFile checks the following:
notwellβ the file is not well-formed XML. πnotvalidβ the file does not follow the XMLTV DTD. π«invalididβ an xmltvid does not look like a proper id, i.e. it does not match/^[-a-zA-Z0-9]+(\.[-a-zA-Z0-9]+)+$/.duplicateidβ more than one channel-entry found for a channelid. Not the main character behaviour we're looking for. πunknownidβ no channel-entry found for a channelid that is used in a programme-entry.noprogrammesβ no programme entries were found in the file. Empty file era, and not in a cute way. πemptytitleβ a programme entry with an empty or missing title was found.emptydescriptionβ a programme entry with an empty desc-element was found. The desc-element shall be omitted if there is no description. (So like, just leave it out, bestie.)badstartβ a programme entry with an invalid start-time was found. β°badstopβ a programme entry with an invalid stop-time was found. β°badepisodeβ a programme entry with an invalid episode number was found.missingtimezoneβ the start/stop time for a programme entry does not include a timezone. Where are you, timezone?? πinvalidtimezoneβ the start/stop time for a programme entry contains an invalid timezone.badiso8859β 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.badutf8β the file is encoded in utf-8 but contains characters that look strange:- Mis-encoded single characters represented with
[EF][BF][BD]bytes - Mis-encoded single characters represented with
[C3][AF][C2][BF][C2][BD]bytes - Mis-encoded single characters in range
[C2][80-9F]
- Mis-encoded single characters represented with
badentityβ the file contains one or more undefined XML entities. π₯
If no errors are found, an empty list is returned. (Yes, an empty list. That's the slay outcome. π)
π BUGS π
It is currently necessary to specify the path to the xmltv dtd-file. This should not be necessary. We know. We're all thinking it. π
π COPYRIGHT π
Copyright (C) 2006 Mattias Holmlund. Respect the icon. π«Ά
This program is free software; you can redistribute it and/or modify it under the terms of the GNU 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 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
β¨ and that's the whole page, bestie β¨
This one's from perl v5.40.1, dated 2025-04-19 β no cap, that's literally the version and the date at the bottom of the page. Mwah. ππ
π¦ where this page comes from
- debian trixie: libxmltv-perl 1.4.0-1 Β· GPL-2.0-only
- ubuntu resolute: libxmltv-perl 1.4.0-1 Β· GPL-2.0-only
- ubuntu stonking: libxmltv-perl 1.4.0-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms