Re: XML Parsing without warning messages

[email protected] Tue, 22 Feb 2005 22:03:59 -0800 (PST)
Newsgroups gmane.lisp.scheme.ssax-sxml
Message-ID <[email protected]>
Hello!

> Can SSAX parse XML documents when DTD is give along with?

The SSAX parser has a hook that is invoked when the parser engine has
come across DTD. The hook is supposed to read DTD and return
information about declared entities and optionally about element
types. The hook can obtain all that information out of DTD. Or the
hook can obtain all that information in some other way, and just skip
DTD. In the function XML->SXML, the hook is set to the function that
merely skips DTD and prints a warning message.

If you look at the function ssax:xml->sxml in SSAX.scm, you can see

	     DOCTYPE
	     (lambda (port docname systemid internal-subset? seed)
	       (when internal-subset?
		     (ssax:warn port
			   "Internal DTD subset is not currently handled ")
		     (ssax:skip-internal-dtd port))
	       (ssax:warn port "DOCTYPE DECL " docname " "
		     systemid " found and skipped")
	       (values #f '() namespaces seed))

So, if you wish to remove the warnings, you remove the two expressions
that contain ssax:warn. You can define function like `ssax:xml->sxml'
(with the adjusted DOCTYPE hook) in your own code. Incidentally, files
daml-parse-unparse.scm, parent-pointers.scm, remove-markup.scm,
outline.scm, and especially validate-doctype-simple.scm in the
SSAX/examples directory show why writing a custom xml->sxml function
can be useful.

	Cheers,
	Oleg


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click