def __init__(self, filePath, absUrl, xmlIf, treeWrapper):
     XMLTreeBuilder.__init__(
         self, target=TreeBuilder(element_factory=ElementExtension))
     self._parser.StartNamespaceDeclHandler = self._start_ns
     self._parser.EndNamespaceDeclHandler = self._end_ns
     self.namespaces = []
     XmlIfBuilderExtensionBase.__init__(self, filePath, absUrl, treeWrapper,
                                        xmlIf.elementWrapperClass)
    def start(self, element, attributes):
        # bugfix for missing start '{'
        for i in range (0, len(attributes), 2):
            attrName = attributes[i]
            namespaceEndIndex = string.find (attrName, '}')
            if namespaceEndIndex != -1 and attrName[0] != "{":
                attributes[i] = '{' + attributes[i]
        # bugfix end

        XmlIfBuilderExtensionBase.startElementHandler (self, element, self._parser.ErrorLineNumber, self.namespaces[:], attributes)
        if len(self._target._elem) > 1:
            element.xmlIfExtSetParentNode (self._target._elem[-2])
        else:
            for namespace in self.namespaces:
                if namespace[1] != None:
                    element.xmlIfExtElementWrapper.setAttribute((XMLNS_NAMESPACE, namespace[0]), namespace[1])
 def end(self, element):
     XmlIfBuilderExtensionBase.endElementHandler(
         self, element, self._parser.ErrorLineNumber)
Beispiel #4
0
 def end(self, element):
     XmlIfBuilderExtensionBase.endElementHandler (self, element, self._parser.ErrorLineNumber)
Beispiel #5
0
 def __init__(self, filePath, absUrl, xmlIf, treeWrapper):
     XMLTreeBuilder.__init__(self, target=TreeBuilder(element_factory=ElementExtension))
     self._parser.StartNamespaceDeclHandler = self._start_ns
     self._parser.EndNamespaceDeclHandler = self._end_ns
     self.namespaces = []
     XmlIfBuilderExtensionBase.__init__(self, filePath, absUrl, treeWrapper, xmlIf.elementWrapperClass)