[Fontconfig] DTD

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Thu May 3 02:48:19 UTC 2018


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.


More information about the Fontconfig mailing list