0.32.0 • Published 2 years ago

@kie-tools/xml-parser-ts v0.32.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

@kie-tools/xml-parser-ts

This lets you parse/build XML strings from/to JSON using types and metadata generated with @kie-tools/xml-parser-ts-codegen. It uses DOMParser or jsdom to parse the XMLs and guarantees that:

  1. Parse/builds are idempotent for XMLs created with
  2. The JSON resulting from parsing is type-safe, as the metada generated by @kie-tools/xml-parser-ts-codegen provides information on what is a string, a boolean, an integer, a float or an array. Even if there's only one element on a sequence, @kie-tools/xml-parser-ts will make sure it is an array with length 1.
  3. The types generated by @kie-tools/xml-parser-ts-codegen can be extended and parsed/built.
  4. Unknown elements/attributes are kept in the original JSON.
  5. Comments ignored.

Some characteristics:

  1. Namespaces declared on the original XML can be preserved when building from the JSON.