
SOAP Responses and Pulling the Payload Out With XPath
Take a SOAP envelope apart: Header, Body, the namespaced response and a Fault, then read the price from the payload in Python without a client library.
Older than half the tools that still emit it. Namespaces, XPath and getting rows out of feeds and exports.

Take a SOAP envelope apart: Header, Body, the namespaced response and a Fault, then read the price from the payload in Python without a client library.

Build one internal model and two small renderers, negotiate the format with the Accept header, and test that both carry the same data on awkward cases.

A step-by-step plan for moving an XML service to JSON without breaking consumers: freeze, map, run both, measure, announce a date and retire.

Generic converters guess at lists, attributes and mixed text. Write a small mapping with explicit rules so the JSON stays predictable for every record.

JSON keys can be any string and XML names cannot. Make legal names from spaces and leading digits, write arrays as repeated elements, and mark null.

XML has attributes, repeated children and mixed text, and JSON has objects and arrays. Where the mapping is lossy, what xmltodict does, and the fixes.

Stream a compressed MediaWiki style export with iterparse, skip redirects, count links and text, and keep memory near 24 MB while reading 176 MB of XML.

Read a UBL style invoice with namespaced lines, recompute each line, sum the net amounts and compare the tax rounded per line with the tax per rate group.

Extract the patient id and measurements from a synthetic CDA clinical document with a namespace map, handle nullFlavor and disable entity resolution.

Read an ISO 20022 style account statement, apply the credit and debit sign, and check that opening balance plus entries equals the closing balance.

Read thousands of journal article XML files straight from a tar.gz, count by year, journal and author count, rank keywords, and avoid unpacking the archive.

Convert CSV to XML with the standard library: invalid tag names and control characters need your own checks; a streaming writer does 193,708 rows in 22 MB.
We send one email when a new article is published. No spam.