ValidateFile(3)
π ValidateFile(3) β the Perl manual page, bestie edition β¨
Okay so picture this: it's ValidateFile(3) from the User Contributed Perl Documentation section, and she's here to make sure your XMLTV file is actually valid and not a whole mess. Let's get into it π«Ά
πΈ NAME πΈ
XMLTV::ValidateFile β literally validates an XMLTV file, that's the whole job, no cap.
π DESCRIPTION π
It's a utility library, iykyk. What it does is validate that a file is correct according to http://wiki.xmltv.org/index.php/XMLTVFormat. That's the vibe check. If your file doesn't match the format spec, this module will find out π
β¨ EXPORTED FUNCTIONS β¨
Bestie listen β all of these functions are exported on demand. You gotta ask for them, they're not just showing up uninvited.
π¦ LoadDtd
Loads the xmltv dtd. Takes a single parameter, which is the name of the xmltv dtd file.
β οΈ Heads up:LoadDtdmust be called beforeValidateFilecan be called. No exceptions, the order matters fr fr.
π ValidateFile
Validates that a file is valid according to the XMLTV dtd and 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 π And she checks the following:
notwellβ the file is not well-formed XML. πnotvalidβ the file does not follow the XMLTV DTD.invalididβ anxmltviddoes 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 achannelid.unknownidβ no channel-entry found for achannelidthat is used in a programme-entry.noprogrammesβ no programme entries were found in the file. Empty. Void. Nothing.emptytitleβ a programme entry with an empty or missing title was found.emptydescriptionβ a programme entry with an emptydesc-element was found. Thedesc-element shall be omitted if there is no description, so likeβ¦ don't do that.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.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. The list, because she's thorough:- 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.
And if no errors are found? An empty list is returned. Clean file, main character energy, we love to see it π
π BUGS π
It is currently necessary to specify the path to the xmltv dtd-file. This should not be necessary. That's it, that's the bug. Annoying, but iconic in its own way π
π COPYRIGHT π
Copyright (C) 2006 Mattias Holmlund.
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.
That's the whole page, periodt π This build is from perl v5.42.2, dated 2025-06-30 β so like, enjoy your very own ValidateFile(3), go forth and validate, bestie ππ
π¦ where this page comes from
- alpine 3.24: xmltv-doc 1.4.0-r1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms