Skip to main content

A convenient library for patching XML files with XPath.

Project description

XML Patcher

Latest release on pypi.org

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.4.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xmlpatcher-1.0.4-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file xmlpatcher-1.0.4.tar.gz.

File metadata

  • Download URL: xmlpatcher-1.0.4.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for xmlpatcher-1.0.4.tar.gz
Algorithm Hash digest
SHA256 e83a776237813cc9da389b8b89b03f6a2fd562876d49dd489789ae8977d3bd58
MD5 dc3c742d8cd980e80f3df5f464c07008
BLAKE2b-256 f73e737029516463a948266bab8b90fc78374f83035c89be23418046af583dc0

See more details on using hashes here.

File details

Details for the file xmlpatcher-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for xmlpatcher-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 aa49fa9311415d243df88f9183d185fd0289eab3d86b5a88292b57f42b5b55ed
MD5 8d4d473290972d3aca3b1e46e7ceedb2
BLAKE2b-256 34fa717321b8cccef1d19f1a7c85a0b400029ca0758698d6fd856b0a15bb543e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page