Author: tack
Date: Tue Apr 25 19:59:28 2006
New Revision: 1495
Modified:
trunk/metadata/src/misc/xmlinfo.py
Log:
Don't use SAX parser -- workaround a segv in libxml2 python bindings
with SAX on certain documents.
Modified: trunk/metadata/src/misc/xmlinfo.py
==============================================================================
--- trunk/metadata/src/misc/xmlinfo.py (original)
+++ trunk/metadata/src/misc/xmlinfo.py Tue Apr 25 19:59:28 2006
@@ -63,17 +63,12 @@
self.mime = 'text/html'
self.type = 'HTML Document'
return
-
- libxml2.SAXParseFile(self, file.name, 10)
-
-
- def startElement(self, tag, attrs):
- """
- Callback for <tag>
- """
- if self.type:
- return
+ ctxt = libxml2.createFileParserCtxt(file.name)
+ # Silence parse errors
+ ctxt.setErrorHandler(lambda *args: None, None)
+ ctxt.parseDocument()
+ tag = ctxt.doc().children.name
if tag in XML_TAG_INFO:
self.type = XML_TAG_INFO[tag]
else:
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog