Beispiel #1
0
    def __init__(self, target=None, validating=False):
        if not compas.IPY:
            raise Exception('CLRXMLTreeParser can only be used from IronPython')

        settings = XmlReaderSettings()
        settings.IgnoreComments = True
        settings.IgnoreProcessingInstructions = True
        settings.IgnoreWhitespace = True
        if not validating:
            settings.DtdProcessing = DtdProcessing.Ignore
            settings.ValidationType = getattr(ValidationType, 'None')
        else:
            settings.DtdProcessing = DtdProcessing.Parse
            settings.ValidationType = ValidationType.DTD
        self.settings = settings
        self._target = target or ET.TreeBuilder()
        self._buffer = []
        self._document_encoding = 'UTF-8'  # default
Beispiel #2
0
        def __init__(self, target=DoctypeTreeBuilder(), validating=False):
            """
            :keyword xml.etree.ElementTree.TreeBuilder target:
               the target object (optional; defaults to
               :class:`aglyph._compat.DoctypeTreeBuilder`)
            :keyword bool validating:
               specify ``True`` to use a validating parser

            """
            settings = XmlReaderSettings()
            settings.IgnoreComments = True
            settings.IgnoreProcessingInstructions = True
            settings.IgnoreWhitespace = True
            if not validating:
                settings.DtdProcessing = DtdProcessing.Ignore
                settings.ValidationType = getattr(ValidationType, "None")
            else:
                settings.DtdProcessing = DtdProcessing.Parse
                settings.ValidationType = ValidationType.DTD
            self.settings = settings
            self.version = platform.python_compiler()
            self.__log.debug("ET parser version is %s", self.version)
            self._target = target
            self._buffer = []
Beispiel #3
0
        def __init__(self, target=DoctypeTreeBuilder(), validating=False):
            """
            :keyword xml.etree.ElementTree.TreeBuilder target:
               the target object (optional; defaults to
               :class:`aglyph._compat.DoctypeTreeBuilder`)
            :keyword bool validating:
               specify ``True`` to use a validating parser

            """
            settings = XmlReaderSettings()
            settings.IgnoreComments = True
            settings.IgnoreProcessingInstructions = True
            settings.IgnoreWhitespace = True
            if not validating:
                settings.DtdProcessing = DtdProcessing.Ignore
                settings.ValidationType = getattr(ValidationType, "None")
            else:
                settings.DtdProcessing = DtdProcessing.Parse
                settings.ValidationType = ValidationType.DTD
            self.settings = settings
            self.version = platform.python_compiler()
            self.__log.debug("ET parser version is %s", self.version)
            self._target = target
            self._buffer = []