summaryrefslogtreecommitdiff
path: root/python/drv_libxml2.py
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2004-10-13 08:57:08 +0000
committerMike Hommey <mh@glandium.org>2004-10-13 08:57:08 +0000
commit0732be88d054db33fa0ca479eab9988c8e6be42e (patch)
tree8b9cf70e04bd32115caebeb74cb0d841d1eced3b /python/drv_libxml2.py
parent09deb06614c3408ec0816a3c88920138bae2083c (diff)
downloadlibxml2-0732be88d054db33fa0ca479eab9988c8e6be42e.tar.gz
Load /tmp/tmp.zzO3vU/libxml2-2.6.14 intoupstream/2.6.14
packages/libxml2/branches/upstream/current.
Diffstat (limited to 'python/drv_libxml2.py')
-rw-r--r--python/drv_libxml2.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/python/drv_libxml2.py b/python/drv_libxml2.py
index 421f945..e43fb1d 100644
--- a/python/drv_libxml2.py
+++ b/python/drv_libxml2.py
@@ -38,7 +38,6 @@ __author__ = u"Stéphane Bidoul <sbi@skynet.be>"
__version__ = "0.3"
import codecs
-import sys
from types import StringType, UnicodeType
StringTypes = (StringType,UnicodeType)
@@ -100,6 +99,7 @@ class LibXml2Reader(xmlreader.XMLReader):
self.__ns = 0
self.__nspfx = 0
self.__validate = 0
+ self.__extparams = 1
# parsing flag
self.__parsing = 0
# additional handlers
@@ -142,10 +142,13 @@ class LibXml2Reader(xmlreader.XMLReader):
reader = input.newTextReader(source.getSystemId())
reader.SetErrorHandler(self._errorHandler,None)
# configure reader
- reader.SetParserProp(libxml2.PARSER_LOADDTD,1)
- reader.SetParserProp(libxml2.PARSER_DEFAULTATTRS,1)
- reader.SetParserProp(libxml2.PARSER_SUBST_ENTITIES,1)
- reader.SetParserProp(libxml2.PARSER_VALIDATE,self.__validate)
+ if self.__extparams:
+ reader.SetParserProp(libxml2.PARSER_LOADDTD,1)
+ reader.SetParserProp(libxml2.PARSER_DEFAULTATTRS,1)
+ reader.SetParserProp(libxml2.PARSER_SUBST_ENTITIES,1)
+ reader.SetParserProp(libxml2.PARSER_VALIDATE,self.__validate)
+ else:
+ reader.SetParserProp(libxml2.PARSER_LOADDTD, 0)
# we reuse attribute maps (for a slight performance gain)
if self.__ns:
attributesNSImpl = xmlreader.AttributesNSImpl({},{})
@@ -316,7 +319,7 @@ class LibXml2Reader(xmlreader.XMLReader):
elif name == feature_external_ges:
return 1 # TODO (does that relate to PARSER_LOADDTD)?
elif name == feature_external_pes:
- return 1 # TODO (does that relate to PARSER_LOADDTD)?
+ return self.__extparams
else:
raise SAXNotRecognizedException("Feature '%s' not recognized" % \
name)
@@ -337,10 +340,7 @@ class LibXml2Reader(xmlreader.XMLReader):
raise SAXNotSupportedException("Feature '%s' not supported" % \
name)
elif name == feature_external_pes:
- if state == 0:
- # TODO (does that relate to PARSER_LOADDTD)?
- raise SAXNotSupportedException("Feature '%s' not supported" % \
- name)
+ self.__extparams = state
else:
raise SAXNotRecognizedException("Feature '%s' not recognized" % \
name)