Exemplo n.º 1
0
    def start_element_handler(self, name, attributes):
        ExpatBuilderNS.start_element_handler(self, name, attributes)

        # use attribute format {namespace}localName
        attrList = []
        for i in range(0, len(attributes), 2):
            attrName = attributes[i]
            attrNameSplit = string.split(attrName, " ")
            if len(attrNameSplit) > 1:
                attrName = (attrNameSplit[0], attrNameSplit[1])
            attrList.extend([attrName, attributes[i + 1]])

        internalMinidomElementWrapper = InternalMinidomElementWrapper(
            self.curNode, self.treeWrapper.getTree())
        XmlIfBuilderExtensionDom.startElementHandler(
            self, internalMinidomElementWrapper,
            self.getParser().ErrorLineNumber, self.curNamespaces[:], attrList)

        if self.curNode.parentNode.nodeType == Node.DOCUMENT_NODE:
            for namespace in self.curNamespaces:
                if namespace[0] != None:
                    internalMinidomElementWrapper.xmlIfExtElementWrapper.attributeSequence.append(
                        (XMLNS_NAMESPACE, namespace[0]))
                else:
                    internalMinidomElementWrapper.xmlIfExtElementWrapper.attributeSequence.append(
                        "xmlns")
Exemplo n.º 2
0
    def start_element_handler(self, name, attributes):
        ExpatBuilderNS.start_element_handler(self, name, attributes)

        # use attribute format {namespace}localName
        attrList = []
        for i in range(0, len(attributes), 2):
            attrName = attributes[i]
            attrNameSplit = string.split(attrName, " ")
            if len(attrNameSplit) > 1:
                attrName = (attrNameSplit[0], attrNameSplit[1])
            attrList.extend([attrName, attributes[i + 1]])

        internalMinidomElementWrapper = InternalMinidomElementWrapper(self.curNode, self.treeWrapper.getTree())
        XmlIfBuilderExtensionDom.startElementHandler(
            self, internalMinidomElementWrapper, self.getParser().ErrorLineNumber, self.curNamespaces[:], attrList
        )

        if self.curNode.parentNode.nodeType == Node.DOCUMENT_NODE:
            for namespace in self.curNamespaces:
                if namespace[0] != None:
                    internalMinidomElementWrapper.xmlIfExtElementWrapper.attributeSequence.append(
                        (XMLNS_NAMESPACE, namespace[0])
                    )
                else:
                    internalMinidomElementWrapper.xmlIfExtElementWrapper.attributeSequence.append("xmlns")
Exemplo n.º 3
0
    def __init__ (self, filePath, absUrl, xmlIf):
        ExpatBuilderNS.__init__(self)
        internalMinidomTreeWrapper = InternalMinidomTreeWrapper(self.document)
        self.treeWrapper = xmlIf.treeWrapperClass(self, internalMinidomTreeWrapper, xmlIf.useCaching)
        XmlIfBuilderExtensionDom.__init__(self, filePath, absUrl, self.treeWrapper, xmlIf.elementWrapperClass)

        # set EndNamespaceDeclHandler, currently not used by minidom
        self.getParser().EndNamespaceDeclHandler = self.end_namespace_decl_handler
        self.curNamespaces = []
Exemplo n.º 4
0
    def __init__ (self, filePath, absUrl, xmlIf):
        ExpatBuilderNS.__init__(self)
        internalMinidomTreeWrapper = InternalMinidomTreeWrapper(self.document)
        self.treeWrapper = xmlIf.treeWrapperClass(self, internalMinidomTreeWrapper, xmlIf.useCaching)
        XmlIfBuilderExtensionDom.__init__(self, filePath, absUrl, self.treeWrapper, xmlIf.elementWrapperClass)

        # set EndNamespaceDeclHandler, currently not used by minidom
        self.getParser().EndNamespaceDeclHandler = self.end_namespace_decl_handler
        self.curNamespaces = []
Exemplo n.º 5
0
 def start_namespace_decl_handler(self, prefix, uri):
     ExpatBuilderNS.start_namespace_decl_handler(self, prefix, uri)
     self.curNamespaces.insert(0, (prefix, uri))
Exemplo n.º 6
0
 def end_element_handler(self, name):
     XmlIfBuilderExtensionDom.endElementHandler(
         self, self.curNode.xmlIfExtInternalWrapper,
         self.getParser().ErrorLineNumber)
     ExpatBuilderNS.end_element_handler(self, name)
Exemplo n.º 7
0
 def start_namespace_decl_handler(self, prefix, uri):
     ExpatBuilderNS.start_namespace_decl_handler(self, prefix, uri)
     self.curNamespaces.insert(0, (prefix, uri))
Exemplo n.º 8
0
 def end_element_handler(self, name):
     XmlIfBuilderExtensionDom.endElementHandler (self, self.curNode.xmlIfExtInternalWrapper, self.getParser().ErrorLineNumber)
     ExpatBuilderNS.end_element_handler(self, name)