Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5diff
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
erp5diff
Commits
3c5d0125
Commit
3c5d0125
authored
Oct 28, 2009
by
Nicolas Delaby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for namespace support
parent
7b75fa37
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
README
README
+75
-0
No files found.
README
View file @
3c5d0125
...
...
@@ -693,6 +693,81 @@ does not work as bellow example. This is a known bug.
<xupdate:update select="/object[3]/title">C</xupdate:update>
</xupdate:modifications>
23. Modify nodes with Qualified Names
ERP5Diff should create xpath valid expression with correct prefix
>>> old_xml = """
... <erp5>
... <object portal_type="Test">
... <prefix:title xmlns:prefix="http://any_uri">A</prefix:title>
... </object>
... <object portal_type="Test">
... <prefixbis:title xmlns:prefixbis="http://any_uri_bis">A</prefixbis:title>
... </object>
... <object portal_type="Test">
... <againanotherprefix:title xmlns:againanotherprefix="http://any_uri">A</againanotherprefix:title>
... </object>
... </erp5>
... """
>>> new_xml = """
... <erp5>
... <object portal_type="Test">
... <anotherprefix:title xmlns:anotherprefix="http://any_uri">A</anotherprefix:title>
... </object>
... <object portal_type="Test">
... <prefix:title xmlns:prefix="http://any_uri" prefix:myattr="anyvalue">B</prefix:title>
... </object>
... <object portal_type="Test">
... <title>A</title>
... </object>
... <erp5:object portal_type="Test" xmlns:erp5="http://www.erp5.org/namespaces/erp5_object">
... <title>B</title>
... </erp5:object>
... <object portal_type="Test">
... <prefix:title xmlns:prefix="http://any_uri">C</prefix:title>
... </object>
... </erp5>
... """
>>> erp5diff.compare(old_xml, new_xml)
>>> erp5diff.output()
<xupdate:modifications xmlns:xupdate="http://www.xmldb.org/xupdate" version="1.0">
<xupdate:remove select="/object[2]/prefixbis:title"/>
<xupdate:append select="/object[2]" child="first()">
<xupdate:element name="prefix:title" namespace="http://any_uri"><xupdate:attribute name="prefix:myattr" namespace="http://any_uri">anyvalue</xupdate:attribute>B</xupdate:element>
</xupdate:append>
<xupdate:remove select="/object[3]/againanotherprefix:title"/>
<xupdate:append select="/object[3]" child="first()">
<xupdate:element name="title">A</xupdate:element>
</xupdate:append>
<xupdate:insert-after select="/object[3]">
<xupdate:element name="erp5:object" namespace="http://www.erp5.org/namespaces/erp5_object"><xupdate:attribute name="portal_type">Test</xupdate:attribute><title>B</title>
</xupdate:element>
<xupdate:element name="object"><xupdate:attribute name="portal_type">Test</xupdate:attribute><prefix:title xmlns:prefix="http://any_uri">C</prefix:title>
</xupdate:element>
</xupdate:insert-after>
</xupdate:modifications>
24. Modify nodes with Qualified Names
Work on Attributes specially
>>> old_xml = """
... <erp5>
... <object portal_type="Test">
... <title xmlns:prefix="http://any_uri" prefix:attr="A">A</title>
... </object>
... </erp5>
... """
>>> new_xml = """
... <erp5>
... <object portal_type="Test">
... <title xmlns:prefix="http://any_uri" prefix:attr="B">A</title>
... </object>
... </erp5>
... """
>>> erp5diff.compare(old_xml, new_xml)
>>> erp5diff.output()
<xupdate:modifications xmlns:xupdate="http://www.xmldb.org/xupdate" version="1.0">
<xupdate:update select="/object/title/attribute::prefix:attr">B</xupdate:update>
</xupdate:modifications>
- 2003-12-04, Yoshinori OKUJI <yo@nexedi.com>
- 2009-09-15, Tatuya Kamada <tatuya@nexedi.com>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment