[plt-scheme] xml.ss and DTDs

From: Felix Klock's PLT scheme proxy (pltscheme at pnkfx.org)
Date: Thu Sep 18 11:50:42 EDT 2008

PLTers-

 From the documentation for the xml.ss library:

> "The xml library does not provides [sic] Document Type Declaration  
> (DTD) processing, validation, expanding user-defined entities, or  
> reading user-defined entities in attributes."


Is the phrase "DTD processing" meant to include functionality such as  
"reading the DOCTYPE declaration given in the input file"?

 From what I can tell from the observable behavior and the source text  
of xml.ss, the XML parsing skips over DOCTYPE declarations in the input.

If the silent dropping of the DTD declaration is intentional, I think  
the documentation should be clearer, and I will file a bug report  
against the docs.  If it is not intentional (or a feature waiting to  
be implemented), then I will file a bug report against the source  
code.  Right now I cannot tell where the bug report belongs.

-Felix

p.s. Here's an example illustrating what I'm talking about:

#lang scheme
(require (lib "xml.ss" "xml"))

(define source-html-string #<<END
<!DOCTYPE html PUBLIC
  "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">         </html>
END
   )

(define source-document (read-xml (open-input-string source-html- 
string)))

(write-xml source-document)
(newline)
;; prints:
;; <html xmlns="http://www.w3.org/1999/xhtml">         </html>
;; and so we've lost information from the input



Posted on the users mailing list.