A convenient library for patching XML files with XPath.
Project description
XML Patcher
A convenient library for patching XML files with XPath.
Usage example:
from xmlpatcher import XMLDocument
from xmlpatcher.patches import SetValue, Remove
document = XMLDocument("./example.xml")
document.patch(
SetValue("/Book/@color", "red"),
Remove("/Book/Page[1]")
)
document.save()
The above code will transform this file:
<Book color="blue">
<Page>Welcome</Page>
<Page>Goodbye</Page>
</Book>
Into this:
<Book color="red">
<Page>Goodbye</Page>
</Book>
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xmlpatcher-1.0.0.tar.gz
(5.2 kB
view hashes)
Built Distribution
Close
Hashes for xmlpatcher-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9144eeb84f3182696176297ccf5e17bd48b937b8899e7bea04518cf5a38ba4a3 |
|
MD5 | 3f0ca8a35e99c02889d1380be3b8615b |
|
BLAKE2b-256 | eb911fe7a20188d15cffb0d84a57dbee5bca43c2fec779d0d29cb272a9fe0759 |