def xmlIfExtProcessWsElementValue (self, wsAction):
        textNodes = self.__xmlIfExtGetChildTextNodes()

        if len(textNodes) == 1:
            textNodes[0].data = processWhitespaceAction (textNodes[0].data, wsAction)
        elif len(textNodes) > 1:
            textNodes[0].data = processWhitespaceAction (textNodes[0].data, wsAction, rstrip=0)
            lstrip = 0
            if len(textNodes[0].data) > 0 and textNodes[0].data[-1] == " ":
                lstrip = 1
            for textNode in textNodes[1:-1]:
                textNode.data = processWhitespaceAction (textNode.data, wsAction, lstrip, rstrip=0)
                if len(textNode.data) > 0 and textNode.data[-1] == " ":
                    lstrip = 1
                else:
                    lstrip = 0
            textNodes[-1].data = processWhitespaceAction (textNodes[-1].data, wsAction, lstrip)
Beispiel #2
0
    def xmlIfExtProcessWsElementValue (self, wsAction):
        textNodes = self.__xmlIfExtGetChildTextNodes()

        if len(textNodes) == 1:
            textNodes[0].data = processWhitespaceAction (textNodes[0].data, wsAction)
        elif len(textNodes) > 1:
            textNodes[0].data = processWhitespaceAction (textNodes[0].data, wsAction, rstrip=0)
            lstrip = 0
            if len(textNodes[0].data) > 0 and textNodes[0].data[-1] == " ":
                lstrip = 1
            for textNode in textNodes[1:-1]:
                textNode.data = processWhitespaceAction (textNode.data, wsAction, lstrip, rstrip=0)
                if len(textNode.data) > 0 and textNode.data[-1] == " ":
                    lstrip = 1
                else:
                    lstrip = 0
            textNodes[-1].data = processWhitespaceAction (textNodes[-1].data, wsAction, lstrip)
 def xmlIfExtProcessWsElementValue (self, wsAction):
     noOfTextFragments = reduce(lambda sum, child: sum + (child.tail != None), self.getchildren(), 0)
     noOfTextFragments += (self.text != None)
             
     rstrip = 0
     lstrip = 1
     if self.text != None:
         if noOfTextFragments == 1:
             rstrip = 1
         self.text = processWhitespaceAction (self.text, wsAction, lstrip, rstrip)
         noOfTextFragments -= 1
         lstrip = 0
     for child in self.getchildren():
         if child.tail != None:
             if noOfTextFragments == 1:
                 rstrip = 1
             child.tail = processWhitespaceAction (child.tail, wsAction, lstrip, rstrip)
             noOfTextFragments -= 1
             lstrip = 0