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.1.tar.gz
(5.4 kB
view hashes)
Built Distribution
Close
Hashes for xmlpatcher-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61de63a5628bd864a691dab1aac08b3619f7ca83d86a5f1ec92b647cfec73341 |
|
MD5 | 92ead2174a25181f85c077a58a1bd902 |
|
BLAKE2b-256 | bc0cebd7aeb40764cdc77814d53c6bc518b3dc94d3136acdbb5aee92166ab223 |