This is a XUpdate Generator for ERP5. See for information on XUpdate. See for information on ERP5. For the installation, do "python setup.py install". Once you have installed erp5diff, you can use "erp5diff" in a shell: $ erp5diff old.xml new.xml See the manpage erp5diff(1) or "erp5diff --help" for more information. Also, you can use the module ERP5Diff from your Python script. Do "pydoc ERP5Diff" for more information. ERP5Diff Usage and its output example ===================================== 1. update the texts of the three elements >>> from ERP5Diff import ERP5Diff >>> erp5diff = ERP5Diff() >>> old_xml = """ ... ... ... description1 --- $sdfrç_sdfsçdf_oisfsopf ... Kamada ... Kamada ... ... ... ... ... ... """ >>> new_xml = """ ... ... ... description3 çsdf__sdfççç_df___&amp;&amp;é]]]°°°°°° ... Tatuya ... Kamada ... ... ... ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() description3 çsdf__sdfççç_df___&amp;&amp;é]]]°°°°°° Tatuya 2009/08/28 19:12:24.703 GMT+9 2. update one element >>> old_xml = """ ... ... ... description2éà@ $*&lt; &lt; ----- ... ... ... """ >>> new_xml = """ ... ... ... description3éà@ $*&lt; &lt; ----- ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() description3éà@ $*&lt; &lt; ----- 3. same >>> old_xml = """ ... ... ... Tatuya Kamada ... <?xml version="1.0"?><marshal><list id="i2"></list></marshal> ... Kamada ... Tatuya ... ... tatuya ... ... ... ... ... """ >>> new_xml = """ ... ... ... Tatuya Kamada ... <?xml version="1.0"?><marshal><list id="i2"></list></marshal> ... Kamada ... Tatuya ... ... tatuya ... ... ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() 4. update the texts of the elements and remove an element >>> old_xml = """ ... ... ... description2éà@ $*&lt; &lt;&lt;&lt; ----- ... en ... ... ... ... ... ... ... ... ... """ >>> new_xml = """ ... ... ... description1 --- $sdfrç_sdfsçdf_oisfsopf ... ... ... ... ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() description1 --- $sdfrç_sdfsçdf_oisfsopf None 5. update two elements includes some symbols >>> old_xml = """ ... ... ... description2éà@ $*&lt;&lt;-----&gt;&gt; ... jp ... ... ... """ >>> new_xml = """ ... ... ... description4 sdflkmooo^^^^]]]]]{{{{{{{ ... ca ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() description4 sdflkmooo^^^^]]]]]{{{{{{{ ca 6. update two date element which have same id >>> old_xml = """ ... ... ... ... ... ... ... ... ... ... ... ... ... ... """ >>> new_xml = """ ... ... ... ... ... ... ... ... ... ... ... ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() 2009/08/28 19:12:40.905 GMT+9 2009/08/28 19:12:40.910 GMT+9 7. insert and remove elements >>> old_xml = """ ... ... ... <?xml version="1.0"?><marshal><tuple><string>Manager</string><string>Owner</string></tuple></marshal> ... <?xml version="1.0"?> ... <?xml version="1.0"?> ... <?xml version="1.0"?> ... ... ... """ >>> new_xml = """ ... ... ... <?xml version="1.0"?><marshal><tuple><string>Owner</string></tuple></marshal> ... Go to the beach ... <?xml version="1.0"?> ... <?xml version="1.0"?> ... <?xml version="1.0"?> ... <?xml version="1.0"?> ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() tokenstatuya<?xml version="1.0"?><marshal><tuple><string>Owner</string></tuple></marshal> Go to the beach tokensManage portal content<?xml version="1.0"?> 8. update xml in xml >>> old_xml = """ ... ... ... <?xml version="1.0"?><marshal><tuple><string>Manager</string><string>Owner</string></tuple></marshal> ... ... ... """ >>> new_xml = """ ... ... ... <?xml version="1.0"?><marshal><tuple><string>Assignee</string><string>Assignor</string><string>Associate</string><string>Auditor</string><string>Author</string><string>Manager</string><string>Owner</string></tuple></marshal> ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() <?xml version="1.0"?><marshal><tuple><string>Assignee</string><string>Assignor</string><string>Associate</string><string>Auditor</string><string>Author</string><string>Manager</string><string>Owner</string></tuple></marshal> 9. rename element >>> old_xml = """ ... ... ... Tatuya ... Kamada ... ... ... """ >>> new_xml = """ ... ... ... Tatuya ... Kamada ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() stringTatuya stringKamada 10. rename root element >>> old_xml = """ ... ... ... 313730 ... Tatuya Kamada ... ... ... """ >>> new_xml = """ ... ... ... 313730 ... Tatuya Kamada ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() erp6 11. Update one attribute >>> old_xml = """ ... ... ... <?xml version="1.0"?><marshal><tuple><string>Owner</string></tuple></marshal> ... ... ... """ >>> new_xml = """ ... ... ... <?xml version="1.0"?><marshal><tuple><string>Owner</string></tuple></marshal> ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() ccc 12. Update two attribute >>> old_xml = """ ... ... ... <?xml version="1.0"?><marshal><tuple><string>Assignee</string><string>Assignor</string><string>Associate</string><string>Auditor</string><string>Author</string><string>Manager</string><string>Owner</string></tuple></marshal> ... ... ... """ >>> new_xml = """ ... ... ... <?xml version="1.0"?><marshal><tuple><string>Assignee</string><string>Assignor</string><string>Associate</string><string>Auditor</string><string>Author</string><string>Manager</string><string>Owner</string></tuple></marshal> ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() ccc ccc 13. Update three attribute >>> old_xml = """ ... ... ... Tatuya Kamada ... ... ... """ >>> new_xml = """ ... ... ... Tatuya Kamada ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() nnn nnn nnn 14. Remove one attribute >>> old_xml = """ ... ... ... Tatuya ... ... ... """ >>> new_xml = """ ... ... ... Tatuya ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() 15. Remove two attribute >>> old_xml = """ ... ... ... Tatuya ... ... ... """ >>> new_xml = """ ... ... ... Tatuya ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() 16. Remove three attribute >>> old_xml = """ ... ... ... Tatuya ... ... ... """ >>> new_xml = """ ... ... ... Tatuya ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() 17. Append one attribute >>> old_xml = """ ... ... ... Kamada ... ... ... """ >>> new_xml = """ ... ... ... Kamada ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() aaa 18. Append two attribute >>> old_xml = """ ... ... ... Kamada ... ... ... """ >>> new_xml = """ ... ... ... Kamada ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() aaa bbb 19. Append three attribute >>> old_xml = """ ... ... ... Kamada ... ... ... """ >>> new_xml = """ ... ... ... Kamada ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() aaa bbb ccc 20. Remove some elements that have same id This is an unexpected case for current ERP5Diff alogrithm. So current ERP5Diff does not work as bellow example. This is a known bug. >>> old_xml = """ ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... """ >>> new_xml = """ ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() 21. Modify two elements that have same id As well as No.20. This a known bug, too. >>> old_xml = """ ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... """ >>> new_xml = """ ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() 2009/08/29 19:12:34.432 GMT+9 2009/08/30 19:12:34.434 GMT+9 2009/08/31 19:12:34.436 GMT+9 22. Modify attributes of sequencial objects ERP5Diff creates target index from 0 as a XPath string, but according to the definition of the XPath specification , it is wrong. It should be start from 1. This is a known problem. >>> old_xml = """ ... ... ... A ... ... ... A ... ... ... A ... ... ... """ >>> new_xml = """ ... ... ... A ... ... ... B ... ... ... C ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() B C 23. Modify nodes with Qualified Names ERP5Diff should create xpath valid expression with correct prefix >>> old_xml = """ ... ... ... A ... ... ... A ... ... ... A ... ... ... """ >>> new_xml = """ ... ... ... A ... ... ... B ... ... ... A ... ... ... B ... ... ... C ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() anyvalueB A Test B Test C 24. Modify nodes with Qualified Names Work on Attributes specially >>> old_xml = """ ... ... ... A ... ... ... """ >>> new_xml = """ ... ... ... A ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() B 25. Modify nodes with Qualified Names at root level Work on Attributes specially >>> old_xml = """ ... ... ... A ... ... ... """ >>> new_xml = """ ... ... ... A ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() aaa:erp5 B 26. Reorder some nodes to the end of list >>> old_xml = """ ...
    ...
  • 1
  • ...
  • 2
  • ...
  • 3
  • ...
  • 4
  • ...
  • 5
  • ...
  • 6
  • ...
  • 7
  • ...
  • 8
  • ...
  • 9
  • ...
... """ >>> new_xml = """ ...
    ...
  • 1
  • ...
  • 2
  • ...
  • 5
  • ...
  • 6
  • ...
  • 7
  • ...
  • 3
  • ...
  • 4
  • ...
  • 8
  • ...
  • 9
  • ...
... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() 3 4 26. Reorder some nodes from the end of list >>> old_xml = """ ...
    ...
  • 1
  • ...
  • 2
  • ...
  • 3
  • ...
  • 4
  • ...
  • 5
  • ...
  • 6
  • ...
  • 7
  • ...
  • 8
  • ...
  • 9
  • ...
... """ >>> new_xml = """ ...
    ...
  • 1
  • ...
  • 2
  • ...
  • 7
  • ...
  • 8
  • ...
  • 3
  • ...
  • 4
  • ...
  • 5
  • ...
  • 6
  • ...
  • 9
  • ...
... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() 7 8 27. Reorder some nodes at start >>> old_xml = """ ...
    ...
  • 1
  • ...
  • 2
  • ...
  • 3
  • ...
  • 4
  • ...
  • 5
  • ...
  • 6
  • ...
  • 7
  • ...
  • 8
  • ...
  • 9
  • ...
... """ >>> new_xml = """ ...
    ...
  • 5
  • ...
  • 6
  • ...
  • 1
  • ...
  • 2
  • ...
  • 3
  • ...
  • 4
  • ...
  • 7
  • ...
  • 8
  • ...
  • 9
  • ...
... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() 5 6 28. Reorder some nodes at the end >>> old_xml = """ ...
    ...
  • 1
  • ...
  • 2
  • ...
  • 3
  • ...
  • 4
  • ...
  • 5
  • ...
  • 6
  • ...
  • 7
  • ...
  • 8
  • ...
  • 9
  • ...
... """ >>> new_xml = """ ...
    ...
  • 1
  • ...
  • 4
  • ...
  • 5
  • ...
  • 6
  • ...
  • 7
  • ...
  • 8
  • ...
  • 9
  • ...
  • 2
  • ...
  • 3
  • ...
... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() 2 3 29. Delete children with white-space as text nodes >>> old_xml = """ ... ... ... ... ... Assignee ... Assignor ... ... ... ... ... """ >>> new_xml = """ ... ... ... ... ... ... ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() 29Bis. Delete childrens with auto-closing nodes >>> old_xml = """ ... ... ... ... ... Assignee ... Assignor ... ... ... ... ... """ >>> new_xml = """ ... ... ... ... ... ... ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() 30. Replace a node by another one following by a modification >>> old_xml = """ ... ... Ballon de Plage ... a5962z ... 200.250000 ... 100.250000 ... ball_size/s4 ... ball_size/s5 ... colour/black ... colour/white ... type/product ... ... """ >>> new_xml = """ ... ... Ballon de Plage ... a5962z ... 120.000000 ... 1357913579130 ... ball_size/s4 ... ball_size/s6 ... colour/red ... colour/white ... type/product ... ... """ >>> erp5diff.compare(old_xml, new_xml) >>> erp5diff.output() 120.000000 ball_size/s6 colour/red 1357913579130 - 2003-12-04, Yoshinori OKUJI - 2009-09-15, Tatuya Kamada