Handling errors in PyXML/SAX
Tom Bridgman
bridgman at wyeth.gsfc.nasa.gov
Tue Jul 17 11:50:13 EDT 2001
I'm finally starting to work with the SAX parser and DTDs. With the SAX
defalult error handler, when parsing a file, I get error messages like:
ERROR in Unknown:94:22: Element 'animationtype' not declared
ERROR in Unknown:98:18: Element 'thumbnail' not declared
ERROR in Unknown:99:14: Element 'medialist' not declared
which I find ideal but for the fact that I would like to print the file
name rather than 'Unknown'.
I've tried setting the systemID (which seems to be where the 'Unknown'
comes from) in a locator object like so:
location=xmlreader.Locator()
location.setSystemId=inputfilename
self.handler.setDocumentLocator(location)
but still get 'Unknown'.
The documentation at http://pyxml.sourceforge.net/topics/docs.html is
really pretty vague on how to use this feature.
Suggestions?
Thanks,
Tom
--
Dr. William T."Tom" Bridgman Scientific Visualization Studio
Global Science & Technology, Inc. NASA/Goddard Space Flight Center
Email: bridgman at wyeth.gsfc.nasa.gov Code 935
Phone: 301-286-1346 Greenbelt, MD 20771
FAX: TBD http://svs.gsfc.nasa.gov/
More information about the Python-list
mailing list