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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

xmlpatcher-1.0.3-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xmlpatcher-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for xmlpatcher-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 39808b05f1fc5122603e84d723a79f46d5a98716ef2259eae77a125122524d75
MD5 14dcfdc23e94f41c14bd1c5196d05d77
BLAKE2b-256 63d4932612e6b7e65c39eaa957846cb2272ee13467a719ce972fb0068b86ee8f

See more details on using hashes here.

Supported by

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