Skip to main content

Light-weight, simple and fast XML parser with XPath support

Project description

Python bindings for pugixml

PyPI PyPI - Python Version PyPI - License pre-commit.ci status tests build

pugixml is a light-weight C++ XML processing library. It features:

  • DOM-like interface with rich traversal/modification capabilities
  • Extremely fast non-validating XML parser which constructs the DOM tree from an XML file/buffer
  • XPath 1.0 implementation for complex data-driven tree queries
  • Full Unicode support with Unicode interface variants and automatic encoding conversions

Documentation

Example

Loading XML document from file:

from pugixml import pugi
doc = pugi.XMLDocument()
result = doc.load_file('xgconsole.xml')
if not result:
    print('parse error: status=%r description=%r' % (result.status, result.description()))

Searching for nodes/attributes with predicates:

tools = doc.child('Profile').child('Tools')

# Find child via predicate (looks for direct children only)
node = tools.find_child(lambda x: x.attribute('AllowRemote').as_bool())
print(node.attribute('Filename').value())

# Find node via predicate (looks for all descendants in depth-first order)
node = doc.find_node(lambda x: x.attribute('AllowRemote').as_bool())
print(node.attribute('Filename').value())

# Find attribute via predicate
attr = tools.last_child().find_attribute(lambda x: x.name() == 'AllowRemote')
print(attr.value())

Selecting nodes via XPath expression:

tools = doc.select_nodes('/Profile/Tools/Tool[@AllowRemote="true" and @DeriveCaptionFrom="lastparam"]')
for tool in tools:
    print(tool.node().attribute('Filename').value())

Using query objects and variables:

varset = pugi.XPathVariableSet()
var = varset.add('remote', pugi.XPATH_TYPE_BOOLEAN)
query_remote_tools = pugi.XPathQuery('/Profile/Tools/Tool[@AllowRemote = string($remote)]', varset)

var.set(True)
tools_remote = query_remote_tools.evaluate_node_set(doc)
for tool in tools_remote:
    tool.node().print(pugi.PrintWriter())

var.set(False)
tools_local = query_remote_tools.evaluate_node_set(doc)
for tool in tools_local:
    tool.node().print(pugi.PrintWriter())

Installation

Installing a package from PyPI

pip install pugixml

Building a package from source

  • Requirements:

  • Installing a package from PyPI:

    pip install --no-binary=:all: pugixml
    
  • Installing the development version from the git repository:

    pip install git+https://github.com/miute/pugixml-python.git
    

License

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

pugixml-0.7.0.tar.gz (359.4 kB view details)

Uploaded Source

Built Distributions

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

pugixml-0.7.0-cp313-cp313-win_amd64.whl (274.9 kB view details)

Uploaded CPython 3.13Windows x86-64

pugixml-0.7.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (382.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pugixml-0.7.0-cp313-cp313-macosx_12_0_x86_64.whl (278.0 kB view details)

Uploaded CPython 3.13macOS 12.0+ x86-64

pugixml-0.7.0-cp313-cp313-macosx_12_0_arm64.whl (249.3 kB view details)

Uploaded CPython 3.13macOS 12.0+ ARM64

pugixml-0.7.0-cp312-cp312-win_amd64.whl (274.9 kB view details)

Uploaded CPython 3.12Windows x86-64

pugixml-0.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (382.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pugixml-0.7.0-cp312-cp312-macosx_12_0_x86_64.whl (277.9 kB view details)

Uploaded CPython 3.12macOS 12.0+ x86-64

pugixml-0.7.0-cp312-cp312-macosx_12_0_arm64.whl (249.3 kB view details)

Uploaded CPython 3.12macOS 12.0+ ARM64

pugixml-0.7.0-cp311-cp311-win_amd64.whl (272.5 kB view details)

Uploaded CPython 3.11Windows x86-64

pugixml-0.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (384.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pugixml-0.7.0-cp311-cp311-macosx_12_0_x86_64.whl (270.1 kB view details)

Uploaded CPython 3.11macOS 12.0+ x86-64

pugixml-0.7.0-cp311-cp311-macosx_12_0_arm64.whl (247.2 kB view details)

Uploaded CPython 3.11macOS 12.0+ ARM64

pugixml-0.7.0-cp310-cp310-win_amd64.whl (271.0 kB view details)

Uploaded CPython 3.10Windows x86-64

pugixml-0.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (382.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pugixml-0.7.0-cp310-cp310-macosx_12_0_x86_64.whl (268.8 kB view details)

Uploaded CPython 3.10macOS 12.0+ x86-64

pugixml-0.7.0-cp310-cp310-macosx_12_0_arm64.whl (245.9 kB view details)

Uploaded CPython 3.10macOS 12.0+ ARM64

pugixml-0.7.0-cp39-cp39-win_amd64.whl (255.3 kB view details)

Uploaded CPython 3.9Windows x86-64

pugixml-0.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (382.9 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

pugixml-0.7.0-cp39-cp39-macosx_12_0_x86_64.whl (268.9 kB view details)

Uploaded CPython 3.9macOS 12.0+ x86-64

pugixml-0.7.0-cp39-cp39-macosx_12_0_arm64.whl (246.0 kB view details)

Uploaded CPython 3.9macOS 12.0+ ARM64

File details

Details for the file pugixml-0.7.0.tar.gz.

File metadata

  • Download URL: pugixml-0.7.0.tar.gz
  • Upload date:
  • Size: 359.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for pugixml-0.7.0.tar.gz
Algorithm Hash digest
SHA256 561011765e0fafb949bb6794e2506f19c9741917c3cd306c2192a931af9ff2ff
MD5 31ce77fddabd4547b15ae17295187156
BLAKE2b-256 ef064e692989c0490cd6b786024225cc3cfe2feb54c59a62b6e390065163131d

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pugixml-0.7.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 274.9 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for pugixml-0.7.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 fd4e15089dcf339a3fa30c646bd5937bb31743d8d801643b7910a45c0da0887e
MD5 dfeefb11a8e3a58d98a9aade3fef550f
BLAKE2b-256 bd6717fd0f922bd42824ec5450a46135a77d56986175a2f63b48b96040a5eb24

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pugixml-0.7.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d6385d4b1a172148205b42400fd7bcb890c25743bad59967dd73603a84204273
MD5 45bba20ce8ff70e5e0ba5b42bdcab4c6
BLAKE2b-256 6e442c69fbe6774b5349ba25f144509a333140244abbd003aa15e9ef0f774e15

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp313-cp313-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pugixml-0.7.0-cp313-cp313-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 db13262664b7492541128b630730cecb7ca16b36bf0873c7fd5082b12a986c8d
MD5 7bfbaa1d9c59611a445eea3d0ec7c588
BLAKE2b-256 3cde8248ac4f220fbaf4e86fd6a24f3d712e729da11793863b64c229a8cb1c50

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp313-cp313-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pugixml-0.7.0-cp313-cp313-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 90182e6e7b759c7822b0041a557036e617b4e678d9c11b05931b5c43bf4f7422
MD5 ba5231f48dcfc80c3c5e3b81aafe52c1
BLAKE2b-256 3f37ea0dc6d8f6add70f745e4976b574644b02c71c29b40358ddcb538830ef95

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pugixml-0.7.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 274.9 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for pugixml-0.7.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5c5649956ab9a36ca3a1284f92a9606d6f74dfeb6b58c8f0d0935492e61c83a8
MD5 bc8ebba2c5f000184ebd262b1572b00b
BLAKE2b-256 22567711a99dedb36fddc9528874975f76a27699dc5aced1eff00a73fa780946

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pugixml-0.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b47bc94bf093ff67989a8aa25bff29e9cb907c2cb4fec3183a9b27e937cae538
MD5 55f19310fe2ce4b4a4fec755c46a82c1
BLAKE2b-256 046f0ec3ab57535a4fb6a06c654b4bbc7645b5472da9847e893710564f8db88a

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp312-cp312-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pugixml-0.7.0-cp312-cp312-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 928d5ba9c72b401befa7062d3f68bee17f1cf82e75aa12d16ea1801a37b59419
MD5 0a2382c46330af1fb789b4f76cca1586
BLAKE2b-256 39100f61f4a51a683e75b4ad517d3dbbc1667e305c2347972c814276d5399632

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp312-cp312-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pugixml-0.7.0-cp312-cp312-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 b20e3aab6f3808eed3e83d886abd2e5a37b8a2a49039679781c798c95af02a6f
MD5 917ec3c383634411cd0ed22ae1956394
BLAKE2b-256 f10e0d67149a38bdc23ef85c40252e622009cda3dd62ed45a87471041d7f421d

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pugixml-0.7.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 272.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for pugixml-0.7.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7e317b4d5e4424f828e3ccdfe14f7d1facd6c2744f57b661ec8a701ac2243685
MD5 82bfe53729b5e5c41ecdc2accf22da18
BLAKE2b-256 8f6a70f37d4114d989ae359c405e30c74d42ee73207ba2411b32a89338395802

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pugixml-0.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b3669d4b2cab6c7c559dffefbad3163fc38304f60e65a0868904c26f79323d1a
MD5 f518cb1814af98c15f3fc9d996b8af51
BLAKE2b-256 875fde6f94078ce9e5c2515a3742445f68d6618950af5b0899a7a8e4294a931d

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp311-cp311-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pugixml-0.7.0-cp311-cp311-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 c072138919bc25ff1705231303975994cc6d4922f9c40c5aba060da3d895fd0c
MD5 370454d0fc97491801edb57542201868
BLAKE2b-256 496d0094ff75fc33ff1884676cca45a8bbe9eb85c24e1535622fb00d93d813d9

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp311-cp311-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pugixml-0.7.0-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 781434f9011367e556ab900085eee2c9201e30b524c168e20404fb9e163d13cc
MD5 c7c6af16ffa9b0e9c169b63266e07a27
BLAKE2b-256 90c8d46416de37b9e5db92132207d82d6fd2c0c41effd09c3bf35013c8ea4cfe

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pugixml-0.7.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 271.0 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for pugixml-0.7.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f09266bc7d7d0a99e8177b7e154313e4786b95bb0c4946a713b484da55971b2f
MD5 f8f746113866659e17dd27a98ab9f3f1
BLAKE2b-256 0160c1ff15eb2ee67f2245df4c16bdaefb4183219b5b32fdf5cedb4fc211d837

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pugixml-0.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c80472b7b9aceacc8e862aff5efa50ddb411d75bbf7d4c56a37f88d56b614707
MD5 7882ee5d2121573c74155c04077c11fb
BLAKE2b-256 186ea5b7bd0f13f64761e25f619b264d49fd2856fc8bd8b5eb60774fa26876d3

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp310-cp310-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pugixml-0.7.0-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 089b0fb5e84c6dc35d042d689d75e793d71525a32ca4df133dd6332b7194e064
MD5 5f7c41e50022b02047791209d9c7c4a2
BLAKE2b-256 6a0829b648652a06b6311307770bc713b01dbcbc2598435c4828dbf95e8b1524

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp310-cp310-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pugixml-0.7.0-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 bcd105c20ef073f8154bf173f3e745e9e19bf63b18a5202f07e19679edc16591
MD5 1123466231c17c6e428c6f66a43c8636
BLAKE2b-256 e7a17d1e1ed517f8978c3bf071481d00bf439cfcb1a058eba061b960e6513faf

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pugixml-0.7.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 255.3 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for pugixml-0.7.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 db42151f615e37aa48cbf7b2c70591a26ccf5fb56c3ab19438d7a36c95aaedac
MD5 5a07222d427cba93622d96a1cfc02f4f
BLAKE2b-256 31adee63333cf4ed315cee33ef5518d08fb4a092c0d90de656e7f42b97c702cc

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pugixml-0.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5963069049f52c773c07165b6024400ec00d0e85e852ee971944ef72fa65c69f
MD5 7bb4a0ca14c6ff9b9fbad0eb4e6da844
BLAKE2b-256 9573cab2e71fb130c3bc174ef17a8a561edc6befe05657cf007f53e3e1a409e2

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp39-cp39-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pugixml-0.7.0-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 9e4b1597b15ae9047900bd08972961b60a26f57ebee3dcedb7a40036feb4f363
MD5 b1dcc53db1d70b54b508e8554f4191d3
BLAKE2b-256 82aac366a0cfb03bdc376a86905e9dd14b61e4d7a17ed5ac2018db829d47d0e1

See more details on using hashes here.

File details

Details for the file pugixml-0.7.0-cp39-cp39-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for pugixml-0.7.0-cp39-cp39-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 930cc124d38e409506ff8bb1356cc4db140651e0090f0d19a793b3e76ffe9191
MD5 55ed68a7d468d87cc95c85bd8b99084e
BLAKE2b-256 6faf6c0ddf156d618355c4fa1b8ee38fad46db4a4f750afbae7048e1cf7e0838

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