# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= python-xmltodict VERSION= 1.0.2 KEYWORDS= python VARIANTS= v13 v14 SDESC[v13]= Makes XML feel like JSON (3.13) SDESC[v14]= Makes XML feel like JSON (3.14) HOMEPAGE= https://github.com/martinblech/xmltodict CONTACT= Python_Automaton[python@ironwolf.systems] DOWNLOAD_GROUPS= main SITES[main]= PYPIWHL/c0/20/69a0e6058bc5ea74892d089d64dfc3a62ba78917ec5e2cfa70f7c92ba3a5 DISTFILE[1]= xmltodict-1.0.2-py3-none-any.whl:main DIST_SUBDIR= python-src DF_INDEX= 1 SPKGS[v13]= single SPKGS[v14]= single OPTIONS_AVAILABLE= PY313 PY314 OPTIONS_STANDARD= none VOPTS[v13]= PY313=ON PY314=OFF VOPTS[v14]= PY313=OFF PY314=ON DISTNAME= xmltodict-1.0.2.dist-info GENERATED= yes [PY313].USES_ON= python:v13,wheel [PY314].USES_ON= python:v14,wheel [FILE:2290:descriptions/desc.single] # xmltodict `xmltodict` is a Python module that makes working with XML feel like you are working with [JSON], as in this ["spec"]: [Tests] ```python >>> print(json.dumps(xmltodict.parse(""" ... ... ... elements ... more elements ... ... ... element as well ... ... ... """), indent=4)) { "mydocument": { "@has": "an attribute", "and": { "many": [ "elements", "more elements" ] }, "plus": { "@a": "complex", "#text": "element as well" } } } ``` ## Namespace support By default, `xmltodict` does no XML namespace processing (it just treats namespace declarations as regular node attributes), but passing `process_namespaces=True` will make it expand namespaces for you: ```python >>> xml = """ ... ... 1 ... 2 ... 3 ... ... """ >>> xmltodict.parse(xml, process_namespaces=True) == { ... 'http://defaultns.com/:root': { ... 'http://defaultns.com/:x': '1', ... 'http://a.com/:y': '2', ... 'http://b.com/:z': '3', ... } ... } True ``` It also lets you collapse certain namespaces to shorthand prefixes, or skip them altogether: ```python >>> namespaces = { ... 'http://defaultns.com/': None, # skip this namespace ... 'http://a.com/': 'ns_a', # collapse "http://a.com/" -> "ns_a" ... } >>> xmltodict.parse(xml, process_namespaces=True, namespaces=namespaces) == { ... 'root': { ... 'x': '1', ... 'ns_a:y': '2', ... 'http://b.com/:z': '3', ... }, ... } True ``` ## Streaming mode `xmltodict` is very fast ([Expat]-based) and has a streaming mode with a small memory footprint, suitable for big XML dumps like [Discogs] or [Wikipedia]: ```python >>> def handle_artist(_, artist): ... print(artist['name']) ... return True >>> >>> xmltodict.parse(GzipFile('discogs_artists.xml.gz'), ... item_depth=2, item_callback=handle_artist) A Perfect Circle Fantômas King Crimson Chris Potter ... ``` [FILE:122:distinfo] 62d0fddb0dcbc9f642745d8bbf4d81fd17d6dfaec5a15b5c1876300aad92af0d 13893 python-src/xmltodict-1.0.2-py3-none-any.whl