Write element tree or element structure to sys.stdout. This function should be used for debugging only. *elem* is either an ElementTree, or a single Element. The exact output format is implementation dependent. In this version, it's written as an ordinary XML file.
(elem)
| 1134 | |
| 1135 | |
| 1136 | def dump(elem): |
| 1137 | """Write element tree or element structure to sys.stdout. |
| 1138 | |
| 1139 | This function should be used for debugging only. |
| 1140 | |
| 1141 | *elem* is either an ElementTree, or a single Element. The exact output |
| 1142 | format is implementation dependent. In this version, it's written as an |
| 1143 | ordinary XML file. |
| 1144 | |
| 1145 | """ |
| 1146 | # debugging |
| 1147 | if not isinstance(elem, ElementTree): |
| 1148 | elem = ElementTree(elem) |
| 1149 | elem.write(sys.stdout, encoding="unicode") |
| 1150 | tail = elem.getroot().tail |
| 1151 | if not tail or tail[-1] != "\n": |
| 1152 | sys.stdout.write("\n") |
| 1153 | |
| 1154 | |
| 1155 | def indent(tree, space=" ", level=0): |
no test coverage detected