summaryrefslogtreecommitdiff
path: root/python/libxml.py
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2002-03-06 17:35:40 +0000
committerDaniel Veillard <veillard@src.gnome.org>2002-03-06 17:35:40 +0000
commit1e77438da7dd912885effa97b1079867d1e041be (patch)
tree5a4ad136a79edcb62bcee8610c7308cf9c9cf771 /python/libxml.py
parentddffd2a789ef4017cc2c779b01e06c7b1c30400d (diff)
downloadlibxml2-1e77438da7dd912885effa97b1079867d1e041be.tar.gz
fix bug #72490 added methods serialize() and saveTo() to all node
* tree.c: fix bug #72490 * python/libxml.c python/libxml.py: added methods serialize() and saveTo() to all node elements. Daniel
Diffstat (limited to 'python/libxml.py')
-rw-r--r--python/libxml.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/python/libxml.py b/python/libxml.py
index 18f68409..8d994662 100644
--- a/python/libxml.py
+++ b/python/libxml.py
@@ -132,7 +132,7 @@ class SAXCallback:
# This class is the ancestor of all the Node classes. It provides
# the basic functionalities shared by all nodes (and handle
# gracefylly the exception), like name, navigation in the tree,
-# doc reference and content access
+# doc reference, content access and serializing to a string or URI
#
class xmlCore:
def __init__(self, _obj=None):
@@ -238,6 +238,17 @@ class xmlCore:
return xmlDoc(_doc=ret)
def free(self):
libxml2mod.freeDoc(self._o)
+
+ #
+ # Serialization routines, the optional arguments have the following
+ # meaning:
+ # encoding: string to ask saving in a specific encoding
+ # indent: if 1 the serializer is asked to indent the output
+ #
+ def serialize(self, encoding = None, format = 0):
+ return libxml2mod.serializeNode(self._o, encoding, format)
+ def saveTo(self, file, encoding = None, format = 0):
+ return libxml2mod.saveNodeTo(self._o, file, encoding, format)
#
# converters to present a nicer view of the XPath returns