コード例 #1
0
    def startElement(self, name, attrs):
        #
        # determine path to the new object
        #
        self.path += "/" + str(name) + "[%d]"
        i = self.previous_path.rfind("[")

        if i >= 0 and self.path[:-4] == self.previous_path[:i]:
            objectIndex = int(self.previous_path[i + 1 : -1]) + 1
        else:
            objectIndex = 1  # XPath indexes begin at 1

        self.path %= objectIndex

        if SimpleXMLReadWriteSupport.testPath(self.path, self.queryPath, attrs):
            self.get_property = True
            self.propertyName = str(name)
            self.propertyValue = ""
        else:
            self.get_property = False
コード例 #2
0
    def startElement(self, name, attrs):
        #
        # determine path to the new object
        #
        self.path += "/" + str(name) + "[%d]"
        i = self.previousPath.rfind("[")

        if i >= 0 and self.path[:-4] == self.previousPath[:i]:
            objectIndex = int(self.previousPath[i + 1 : -1]) + 1
        else:
            objectIndex = 1  # XPath indexes begin at 1

        self.path %= objectIndex

        if SimpleXMLReadWriteSupport.testPath(self.path, self.queryPath, attrs):
            self.getProperty = True
            self.propertyName = str(name)
            self.propertyValue = ""
        else:
            self.getProperty = False