Traverses the tree, stripping out whitespace until text data is found :param node: The node to strip :return: True if non-whitespace data was found, False otherwise
(self, node)
| 154 | super(LineItemNode, self).write(doc) |
| 155 | |
| 156 | def _lstrip(self, node): |
| 157 | """ |
| 158 | Traverses the tree, stripping out whitespace until text data is found |
| 159 | :param node: The node to strip |
| 160 | :return: True if non-whitespace data was found, False otherwise |
| 161 | """ |
| 162 | for child in node.children: |
| 163 | if isinstance(child, DataNode): |
| 164 | child.lstrip() |
| 165 | if child.data: |
| 166 | return True |
| 167 | else: |
| 168 | found = self._lstrip(child) |
| 169 | if found: |
| 170 | return True |
| 171 | |
| 172 | return False |
| 173 | |
| 174 | |
| 175 | class DataNode(Node): |