{ "info": { "author": "Rados\u0142aw Szalski", "author_email": "radoslaw.szalski@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing :: Markup :: XML", "Topic :: Utilities" ], "description": ".. image:: https://travis-ci.org/stxnext/mappet.svg\n :target: https://travis-ci.org/stxnext/mappet\n :alt: Travis CI\n\n.. image:: http://codecov.io/github/stxnext/mappet/coverage.svg?branch=master\n :target: http://codecov.io/github/stxnext/mappet?branch=master\n :alt: Codecov\n\n.. image:: https://codeclimate.com/github/stxnext/mappet/badges/gpa.svg\n :target: https://codeclimate.com/github/stxnext/mappet\n :alt: Code Climate\n\n.. image:: http://www.quantifiedcode.com/api/v1/project/4f798b7ea0954d8790f3fe420a5fde0e/badge.svg\n :target: http://www.quantifiedcode.com/app/project/4f798b7ea0954d8790f3fe420a5fde0e\n :alt: Code issues\n\n.. image:: https://www.codacy.com/project/badge/4ea440e5fa5045acb376e6461e804179\n :target: https://www.codacy.com/app/radoslaw-szalski/mappet\n :alt: Codacy\n\n.. image:: https://readthedocs.org/projects/mappet/badge/?version=latest\n :target: https://readthedocs.org/projects/mappet/?badge=latest\n :alt: Documentation Status\n\n\n==========\n``mappet``\n==========\n\n``Mappet`` has been created to enable an easy an intuitive way to work with XML\nstructures in Python code.\n\nA well known ``lxml`` module has been used under the hood, mainly due to XML parsing performance.\n\n\nMappet accepts a string with valid XML, an ``lxml.etree._Element`` object or a dict\nrepresenting the XML tree.\n\n>>> import mappet\n>>> f = open('example.xml', 'r')\n>>> m = mappet.Mappet(f.read())\n\nAs an example, an XML document of the following structure has been used:\n\n.. code-block:: xml\n\n \n \n \n \n Mr Sender\n 2015-07-13T10:56:05.597420+02:00\n reply-type\n \n \n id\n \n \n OK\n \n \n \n \n 12345\n BMW\n X6\n SUV\n Diesel\n 5\n 3000\n 256\n Automatic\n 5\n 3690\n \n \n 54321\n BMW\n X1\n SUV\n Diesel\n 5\n 3000\n 198\n Automatic\n 5\n 2890\n \n \n \n \n\n\nConventions\n===========\n\nEvery XML node can be accessed in two ways: by attribute and item access.\n\n\nDictionary access:\n------------------\n\nDictionary access is possible thanks to XML document being represented as a\nPython dictionary. Conversion of values is done explicitly.\n\nBy default, values are returned as ``str``.\n\n>>> m['reply']['cars']['Car'][0]['Manufacturer']\n'BMW'\n\nNodes' names are case-sensitive.\n\n\nAttribute access:\n-----------------\n\nDue to restrictions in Python variable names, tag names are normalized for attribute access.\nTag names are normalized to lowercase and hyphens to underlines.\n\nSame example using attribute access (__repr__ is responsible for representing the tag):\n\n>>> m.reply.cars.car[0].manufacturer\nBMW\n\nTo get a string representation use ``get()``.\n\n>>> m.reply.cars.car[0].manufacturer.get()\n'BMW'\n\n``get()`` has two parameters, *default* and *callback*. The first one is returned when then node's value is empty, the\nsecond is a function to be called upon the returned value.\n\n>>> m.reply.cars.car[0].ccm.get(callback=int)\n3000\n\nAlternatively, one can use built-in helper functions, defined in helpers.py\n\n>>> m.reply.cars.car[0].ccm.to_int()\n3000\n\nHelper functions\n================\n\n- to_bool\n- to_int\n- to_str\n- to_string\n- to_float\n- to_time\n- to_datetime\n- to_date", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/stxnext/mappet", "keywords": "xml parsing mapping", "license": "GNU Lesser General Public License v3(LGPLv3)", "maintainer": null, "maintainer_email": null, "name": "mappet", "package_url": "https://pypi.org/project/mappet/", "platform": "any", "project_url": "https://pypi.org/project/mappet/", "project_urls": { "Homepage": "https://github.com/stxnext/mappet" }, "release_url": "https://pypi.org/project/mappet/0.1.2/", "requires_dist": [ "lxml", "python-dateutil", "pytest; extra == 'testing'", "mock; extra == 'testing'", "tox; extra == 'testing'" ], "requires_python": null, "summary": "Work with XML documents as if they were Python objects", "version": "0.1.2" }, "last_serial": 1696093, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "4bab0a4dbba35644734dbbb1dcf44028", "sha256": "0f0296c6ab054a37808de475e6c801641d7a51996bf3acd5424bdbd8a0ed5850" }, "downloads": -1, "filename": "mappet-0.1.1-py2-none-any.whl", "has_sig": false, "md5_digest": "4bab0a4dbba35644734dbbb1dcf44028", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 13640, "upload_time": "2015-08-12T20:14:32", "url": "https://files.pythonhosted.org/packages/d4/62/11207be8d9004dad03a4574633d09e2a6162f8d19f0d23d18989fd9cd031/mappet-0.1.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a06959e32d9d86229935ade684c99e61", "sha256": "5ebb4a6241cfa8949b6d42357f71f1bee96de73325bb0ade892add58a465e420" }, "downloads": -1, "filename": "mappet-0.1.1.tar.gz", "has_sig": false, "md5_digest": "a06959e32d9d86229935ade684c99e61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10639, "upload_time": "2015-08-12T20:14:36", "url": "https://files.pythonhosted.org/packages/13/46/cabd295f745a92e3a3d25ab0285fdec05033c737515f8c6997e10cfddef9/mappet-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "faf0bb490f06d1945f6f33d303f5df8c", "sha256": "5547df1e4a7129f44d78ae65f73b2bec95dfc8b38abda6babc1034ecaec573ee" }, "downloads": -1, "filename": "mappet-0.1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "faf0bb490f06d1945f6f33d303f5df8c", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 13749, "upload_time": "2015-08-27T10:11:49", "url": "https://files.pythonhosted.org/packages/57/31/a2640e90586af356c6063f2bac91fe11736e45fb7d4c9ff414ce6de9c7f4/mappet-0.1.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "50310ab48e3952551252936a7c5e2e7f", "sha256": "40c6e394d6986e2a2ec24ad83296c100539886460c6b9110e3842b170198a743" }, "downloads": -1, "filename": "mappet-0.1.2.tar.gz", "has_sig": false, "md5_digest": "50310ab48e3952551252936a7c5e2e7f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10724, "upload_time": "2015-08-27T10:11:54", "url": "https://files.pythonhosted.org/packages/a2/fa/a2b5a78703bb1b93cffebbc534092595b9da88f323bc4d94eaaf4fb7877c/mappet-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "faf0bb490f06d1945f6f33d303f5df8c", "sha256": "5547df1e4a7129f44d78ae65f73b2bec95dfc8b38abda6babc1034ecaec573ee" }, "downloads": -1, "filename": "mappet-0.1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "faf0bb490f06d1945f6f33d303f5df8c", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 13749, "upload_time": "2015-08-27T10:11:49", "url": "https://files.pythonhosted.org/packages/57/31/a2640e90586af356c6063f2bac91fe11736e45fb7d4c9ff414ce6de9c7f4/mappet-0.1.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "50310ab48e3952551252936a7c5e2e7f", "sha256": "40c6e394d6986e2a2ec24ad83296c100539886460c6b9110e3842b170198a743" }, "downloads": -1, "filename": "mappet-0.1.2.tar.gz", "has_sig": false, "md5_digest": "50310ab48e3952551252936a7c5e2e7f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10724, "upload_time": "2015-08-27T10:11:54", "url": "https://files.pythonhosted.org/packages/a2/fa/a2b5a78703bb1b93cffebbc534092595b9da88f323bc4d94eaaf4fb7877c/mappet-0.1.2.tar.gz" } ] }