Project

General

Profile

« Previous | Next » 

Revision 2599

xml_func.py: Removed no longer used strip()

View differences:

lib/xml_func.py
102 102
                
103 103
            on_error(e)
104 104

  
105
def strip(node, preserve=set()):
106
    '''Replaces every XML function with its last parameter (which is usually its
107
    value), except for structural functions, which are evaluated by process().
108
    @param preserve set(str...) XML functions not to remove.
109
        * container can be any iterable type
110
    '''
111
    preserve = set(preserve)
112
    
113
    name = node.tagName
114
    is_func = is_xml_func_name(name) and name not in preserve
115
    if is_func and name in structural_funcs: process(node)
116
    else:
117
        for child in xml_dom.NodeElemIter(node): strip(child, preserve)
118
        if is_func:
119
            value = pop_value(list(xml_dom.NodeTextEntryIter(node)), None)
120
            xml_dom.replace_with_text(node, value)
121

  
122 105
##### XML functions
123 106

  
124 107
# Function names must start with _ to avoid collisions with real tags

Also available in: Unified diff