AnyXml
A minimal reimplementation of ET.tostring that supports unescaped "raw" text content.
The standard library's ET.tostring always XML-escapes the text/tail content of elements (e.g. <, &), which makes it impossible to inject pre-built, already-valid XML fragments (or other raw strings) during serialization.
This class provides :meth:tostring, which behaves similarly to ET.tostring but additionally supports:
- Strings wrapped in :class:
RawTextare emitted verbatim during serialization, without any escaping; regularstrtext is still escaped according to XML rules. - Comment nodes (
ET.Comment) and processing instruction nodes (ET.ProcessingInstruction) are rendered as<!--...-->and<?...?>respectively. - Elements with no text and no children are rendered as self-closing tags (
<tag/>).
Example
>>> el = ET.Element("p")
>>> el.text = AnyXml.RawText("<b>bold</b>")
>>> AnyXml.tostring(el)
'<p><b>bold</b></p>'
Metadata
Release files for anyxml 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| anyxml-0.1.0.tar.gz | 1.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| anyxml-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.4 kB
Release files / anyxml-0.1.0.tar.gz
| Download URL | anyxml-0.1.0.tar.gz |
|---|---|
| Size | 1.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d39aa376bb770f3f140086f7ab9756e12912b850700428780c3efc5f506fb00
|
|
BLAKE2b-256 checksum How to use checksums |
53cc5cea09e7969c9171445012d8507a428f38d7d7aaedb81c57aee3ee5a8a7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.
Transparency logRelease files / anyxml-0.1.0-py3-none-any.whl
| Download URL | anyxml-0.1.0-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8c5c99b26cb3d4de91b277fdfdc1a0181376bc387a978390429644c5087d502e
|
|
BLAKE2b-256 checksum How to use checksums |
3cc03c9df7fc59b6be46a400d7782c614213a53f4e2ff986c279ccc04e0eb57c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.
Transparency log