Esempio n. 1
0
    def setFeature(self, name, state):
        if self.__parsing:
            raise saxlib.SAXNotSupportedException(
                "Cannot set feature '%s' during parsing" % name)

        if name == saxlib.feature_validation:
            self.__validate = state
            if self.__validate:
                self.__ext_pes = 1
        elif name == saxlib.feature_namespaces:
            self.__namespaces = state
        elif name == saxlib.feature_external_ges or \
             name == saxlib.feature_string_interning:
            if not state:
                raise saxlib.SAXNotSupportedException(
                    "This feature cannot be turned off with xmlproc.")
        elif name == saxlib.feature_namespace_prefixes:
            if state:
                raise saxlib.SAXNotSupportedException(
                    "This feature cannot be turned on with xmlproc.")
        elif name == saxlib.feature_external_pes:
            self.__ext_pes = state
        else:
            raise saxlib.SAXNotRecognizedException(
                "Feature '%s' not recognized" % name)
Esempio n. 2
0
 def setLocale(self, locale):
     try:
         self.parser.set_error_language(locale)
     except KeyError:
         raise saxlib.SAXNotSupportedException("Locale '%s' not supported" %
                                               locale)