comparison emeraldtree/tree.py @ 74:a271e50bea43

Tree - Redefine ElementTree write with Node write
author Bastian Blank <bblank@thinkmo.de>
date Fri, 04 Jun 2010 13:46:06 +0200
parents 048d2f8de762
children d9ac9fe47760
comparison
equal deleted inserted replaced
73:641657361783 74:a271e50bea43
633 if not hasattr(file, "write"): 633 if not hasattr(file, "write"):
634 file = open(file, "wb") 634 file = open(file, "wb")
635 write = file.write 635 write = file.write
636 if not encoding: 636 if not encoding:
637 encoding = "us-ascii" 637 encoding = "us-ascii"
638 if not method or method == "xml":
639 Writer = XMLWriter
640 elif method == "html":
641 Writer = HTMLWriter
642 else:
643 Writer = TextWriter
644 638
645 if default_namespace: 639 if default_namespace:
646 namespaces = namespaces.copy() 640 namespaces = namespaces.copy()
647 namespaces[default_namespace] = '' 641 namespaces[default_namespace] = ''
648 642
649 Writer(encoding, namespaces).write(write, self._root) 643 self._root.write(write, encoding=encoding, namespaces=namespaces, method=method)
650 644
651 # -------------------------------------------------------------------- 645 # --------------------------------------------------------------------
652 # serialization support 646 # serialization support
653 647
654 # -------------------------------------------------------------------- 648 # --------------------------------------------------------------------