[Fontconfig] DTD
jerrycasiano at gmail.com
jerrycasiano at gmail.com
Thu May 3 04:04:44 UTC 2018
That's a pretty cool approach.
The reality is I'm not so much concerned about whether the values are
valid or not, more that the structure of the file itself is valid.
I was under the impression that's what a DTD is for.
In any case, if I get around to it I'll probably modify your script to
return a pass/fail and use that instead.
Thanks for sharing.
On Thu, 2018-05-03 at 14:48 +1200, Lawrence D'Oliveiro wrote:
> On Wed, 02 May 2018 22:14:35 -0400, jerrycasiano at gmail.com wrote:
>
> > Since it doesn't really take any time or effort and it's pointed
> > out
> > silly mistakes in the past, I think I'll continue to do what I'm
> > doing
> > rather than wait for users to file bugs.
>
> Following is a pretty trivial, not to say useless, example of a
> Fontconfig file, designed purely to show the kinds of errors that no
> DTD can pick up.
>
> Pass:
>
> <!-- config parsing test -->
> <fontconfig>
> <int>3</int>
> </fontconfig>
>
> Fail:
>
> <!-- config parsing test -->
> <fontconfig>
> <int>3.5</int>
> </fontconfig>
>
> The error report:
>
> Fontconfig error: ..., line 3: "3.5": not a valid integer
>
> Here’s the very simple validator script I used:
>
> #!/usr/bin/python3
>
> import sys
> import fontconfig
>
> conf = fontconfig.Config.create()
> conf.parse_and_load \
> (
> filename = sys.argv[1],
> complain = True
> )
> sys.stdout.write("parse completed OK?\n")
>
> And not a DTD in sight.
> _______________________________________________
> Fontconfig mailing list
> Fontconfig at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/fontconfig
More information about the Fontconfig
mailing list