[plt-scheme] xml library: getting DTD information

From: Richard Cobbe (cobbe at ccs.neu.edu)
Date: Tue May 27 22:57:39 EDT 2008

On Tue, May 27, 2008 at 01:38:55PM -0700, John Clements wrote:
> On May 25, 2008, at 9:29 AM, Richard Cobbe wrote:
>> I'm having a little difficulty with the XML library, and I'm not sure
>> whether this is a bug in the library or in my XML file.
> ...
> This is regression advice rather than actual advice, but it might be
> helpful: have you tried parsing the same file with the sxml library?
> It'll be something like
> (require (planet "sxml.ss" (lizorkin "sxml.plt" 2 0)
>    (planet "ssax.ss" (lizorkin "ssax.plt" 2 0)))
> (xml->sxml (open-input-file ...))
> ...
> I've probably got the minor revision number wrong on one of these... I
> seem to recall a 2.1 in there.

I'm certainly willing to try other libraries, but this doesn't seem to work
any better.  (And you had the version numbers correct.)

    > (require (planet "sxml.ss" ("lizorkin" "sxml.plt" 2 0))
               (planet "ssax.ss" ("lizorkin" "ssax.plt" 2 0)))
    > (sxml:document "test.xml")

    Warning at position 123
    (DOCTYPE DECL  keyboard   file://localhost/System/Library/DTDs/KeyboardLayout.dtd  found and skipped)
     (*PI* xml "version=\"1.1\" encoding=\"UTF-8\"")
     (keyboard (@ (name "US Extended") (maxout "3") (id "-2") (group "126"))))

Note that sxml:document prints the "Warning ..." and "(DOCTYPE ..." lines
to the console (either stdout or stderr, not sure which) and returns the
list starting with '*TOP* as the result.

I haven't fully read through the SXML/SSAX manuals, but the default
behavior doesn't appear to be any different from the built-in XML library
(aside from a really unfortunate way of signaling warnings, although one
may be able to change that with a library configuration option that I
haven't seen yet).


Posted on the users mailing list.