Skip to main content

Fast XML to Python data (and vise versa) converter and filter. Written in C++ using Expat SAX parser.

Project description

Introduction
============

nkit4py - is a nkit C++ library port to Python (see https://github.com/eye3/nkit.git).

With nkit4py module you can convert XML string to Python data and vise versa.

With XML-to-Python-data possibilities you can:
----------------------------------------------

- Create Python data structures, which are different from the structure
of XML source.

- Create multiple Python structures from one XML source.

- Explicitly identify those elements and attributes in XML source that you
want to use for building Python data structures.
Thus, it's possible to filter out unnecessary XML-data.

- Explicitly define Python type of scalar (primitive) data,
fetched from XML source.
Integers, numbers, strings, datetimes and booleans are supported.

- Control progress of chunked download and parsing of big XML string

- With extra options you can tune some aspects of conversion:
- trim text data
- explicitly define white space characters for trim option
- choose unicode or string type for text data
- define special key to collect all element attributes

Conversion is carried out using SAX parser Expat, so it's fast and uses less
memory when parsing huge XML files.

Module supports not only native Expat XML encodings, but also many others
(see /deps/nkit/src/encoding/langs.inc)

With Python-data-to-XML possibilities you can:
----------------------------------------------

- Create xml string with the same structure as Python data
- Define root element name of result xml string
- Define default element name for list items
- Define encoding of result xml string
- Pretty print with custom indentation and newline characters
- Define special object key name for attributes
- Define special object key name for text
- Define which elements of result xml string must contain CDATA section
- Define precision for float numbers
- Define format for Date objects
- Define representation for *True* and *False* values


Installation
============

On Linux and Mac OS
-----------------

pip install nkit4py

On Windows
----------

Library compiles on MSVS Express version >= 2012.

For MSVS 2012:

SET VS90COMNTOOLS=%VS110COMNTOOLS%

pip install nkit4py

For MSVS 2013:

SET VS90COMNTOOLS=%VS120COMNTOOLS%

pip install nkit4py

Usage
=====

See https://github.com/eye3/nkit4py

Author
======

Boris T. Darchiev (boris.darchiev@gmail.com)

On github: https://github.com/eye3

Any feedback or pull request are welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

nkit4py-2.2.1.zip (346.2 kB view details)

Uploaded Source

nkit4py-2.2.1.tar.gz (263.8 kB view details)

Uploaded Source

File details

Details for the file nkit4py-2.2.1.zip.

File metadata

  • Download URL: nkit4py-2.2.1.zip
  • Upload date:
  • Size: 346.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for nkit4py-2.2.1.zip
Algorithm Hash digest
SHA256 7910345213f98b5eded9915d0114d76afa7f7abd0b61beb9a1f6b1a5e5c130bb
MD5 c5c1c497f0dc88e0c76b7955535e5e50
BLAKE2b-256 aa1077afd38870cbc64f0383882d64765fda7a383b88e7b58de59bc4a5cd1278

See more details on using hashes here.

File details

Details for the file nkit4py-2.2.1.tar.gz.

File metadata

  • Download URL: nkit4py-2.2.1.tar.gz
  • Upload date:
  • Size: 263.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for nkit4py-2.2.1.tar.gz
Algorithm Hash digest
SHA256 bfc6a90f0c7adf068c7b3ffc3e3c3007f20d51ce25088b1a59cc54cd140ad23d
MD5 aba303796c356d05c1aa45694f028ca3
BLAKE2b-256 7f73edbe0fa462c163742cfadb1dc1931e0b0ef3f9d69ee3635646d4320a24a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page