Skip to main content

urban-json-xml

Plugin urban-json : lecture de fichiers XML dans les templates, via la fonction loadxml. Suit les conventions XML↔JSON du XmlNodeConverter (.NET/Newtonsoft).

Installation

pip install urban-json-xml      # tire urban-json et defusedxml en dépendances

urban-json découvre le plugin automatiquement via les entry points (urban_json.functions) : loadxml devient utilisable dans les templates.

Utilisation

from urban_json import JsltTemplate

# catalog.xml :
#   <catalog>
#     <book id="1"><title>A</title></book>
#     <book id="2"><title>B</title></book>
#   </catalog>
tpl = JsltTemplate.parse('[ { "$source": select(loadxml("catalog.xml"), $.catalog.book), "t": $.title } ]')
tpl.transform({})
# -> [{'t': 'A'}, {'t': 'B'}]

loadxml renvoie un objet ; on navigue dedans avec select/selectmany (fonctions du cœur) avant d'alimenter une boucle $source, un filtre ?(...), etc.

Conventions de conversion (Newtonsoft)

XML JSON
<a>v</a> {"a": "v"}
<a x="1">v</a> {"a": {"@x": "1", "#text": "v"}}
<a/> {"a": null}
<a><b>1</b><b>2</b></a> {"a": {"b": ["1", "2"]}} (frères homonymes → tableau)
  • Attributs → propriétés préfixées par @.
  • Texte d'un élément mixte → clé #text.
  • Les valeurs restent des chaînes (comme Newtonsoft, pas de coercition).

Signature

loadxml(source_path, attribute_prefix="@", text_key="#text", strip_namespaces=true)
Paramètre Rôle
source_path chemin du fichier XML
attribute_prefix préfixe des propriétés issues d'attributs (défaut @)
text_key clé portant le texte d'un élément mixte (défaut #text)
strip_namespaces réduit {uri}local au nom local (défaut true)

Sécurité

Le XML est analysé avec defusedxml : entités externes et expansion d'entités désactivées (protection XXE / « billion laughs »).

Licence

Apache-2.0.

Metadata

Release files for urban-json-xml 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for urban-json-xml 0.1.0
File Size Uploaded Provenance Actions
urban_json_xml-0.1.0.tar.gz 6.4 kB With provenance Details for urban_json_xml-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for urban-json-xml 0.1.0
File Interpreter ABI Platform Actions
urban_json_xml-0.1.0-py3-none-any.whl Python 3 none any Details for urban_json_xml-0.1.0-py3-none-any.whl

Total release size: 12.1 kB

Release files / urban_json_xml-0.1.0.tar.gz

Download URL urban_json_xml-0.1.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f64f21a510fe2f4a0393d770265abb4a389c37f6b640d5dd8dedf75a20aabb5e
BLAKE2b-256 checksum
How to use checksums
33f57b468459269127874b6411549664a3a0236bebde30c270cf265f4627a177
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Release files / urban_json_xml-0.1.0-py3-none-any.whl

Download URL urban_json_xml-0.1.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb5249a19e55850c2360ba0c3b30567f78bf1daf82b44f04419d3367127955df
BLAKE2b-256 checksum
How to use checksums
f1a9d55a24e8f5288e9db0c70741ebf07ade361c6896f9a7bbfa49666d6f7a5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Security for urban-json-xml 0.1.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for urban_json_xml-0.1.0.tar.gz

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 Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page