Kind: function.
Parse one KEX XML file and return a JSON-friendly dict.
The conversion is lossless for data:
"@name" keys."#text"; pure-text
leaves collapse to their string value.None.xmlns declarations from the root element
are preserved on the root's value under "@_xmlns"
so the namespace family is still recoverable.
NXP publishes no XSDs, but agents that only speak JSON still need
to read every byte of the silicon data. A namespace-stripped tree
with an @_xmlns sidecar gives readability without
losing the namespace family. xmltodict-style conventions keep the
output predictable.
Kind: function.
Walk every .xml under xml_root and write a
parallel .json tree under json_root. The
path mapping is one-to-one: a/b/c.xml becomes
a/b/c.json. Existing destination files are overwritten.
Files that fail to parse are skipped silently; the raw XML is still
available under xml_root. Returns the number of
successfully written JSON files.
include and exclude are lists of fnmatch
glob patterns evaluated against the xml_root-relative
forward-slash path. When include is non-empty, only
matching files are converted. exclude is applied after.
progress_callback matches the
ProgressCallback = Callable[[int, int, str], None]
signature. It is invoked once with (0, total, "")
after filtering and before any file is written, then after each
successful conversion with
(done, total, rel_posix). Parse failures advance
neither done nor total.
Pure on-disk read/write; does not fetch. Use after
fetch() or against any KEX XML tree already on disk.
fetch drives this internally to populate
DIR/<PART>/json/<VARIANT>/; the public
function is for callers that want to re-mirror an existing tree or
apply different filters.