[Erp5-report] r42463 nicolas - /erp5/trunk/utils/xupdate_processor/README.txt

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jan 19 16:49:43 CET 2011


Author: nicolas
Date: Wed Jan 19 16:49:43 2011
New Revision: 42463

URL: http://svn.erp5.org?rev=42463&view=rev
Log:
add readme.txt

Added:
    erp5/trunk/utils/xupdate_processor/README.txt

Added: erp5/trunk/utils/xupdate_processor/README.txt
URL: http://svn.erp5.org/erp5/trunk/utils/xupdate_processor/README.txt?rev=42463&view=auto
==============================================================================
--- erp5/trunk/utils/xupdate_processor/README.txt (added)
+++ erp5/trunk/utils/xupdate_processor/README.txt [utf8] Wed Jan 19 16:49:43 2011
@@ -0,0 +1,55 @@
+Introduction
+============
+
+Apply xupdate diff on XML documents.
+
+
+Installation
+============
+
+python setup.py install
+
+
+Testing
+=======
+
+python setup.py test
+
+Usage
+=====
+
+just like this::
+  >>> from xupdate_processor import applyXUpdate
+  >>> from lxml import etree
+  >>> xml_doc_string = """<?xml version="1.0"?>
+  <erp5>
+    <object portal_type="Test">
+      <title>A</title>
+    </object>
+    <object portal_type="Test">
+      <title>A</title>
+    </object>
+    <object portal_type="Test">
+      <title>A</title>
+    </object>
+  </erp5>
+  """
+  >>> xml_xu_string = """<?xml version="1.0"?>
+  <xupdate:modifications xmlns:xupdate="http://www.xmldb.org/xupdate" version="1.0">
+    <xupdate:update select="/erp5/object[2]/title">B</xupdate:update>
+    <xupdate:update select="/erp5/object[3]/title">C</xupdate:update>
+  </xupdate:modifications>
+  """
+  >>> result_tree = applyXUpdate(xml_xu_string=xml_xu_string, xml_doc_string=xml_doc_string)
+  >>> print etree.tostring(result_tree, pretty_print=True)
+  <erp5>
+    <object portal_type="Test">
+      <title>A</title>
+    </object>
+    <object portal_type="Test">
+      <title>B</title>
+    </object>
+    <object portal_type="Test">
+      <title>C</title>
+    </object>
+  </erp5>



More information about the Erp5-report mailing list