Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Kids XML library.

Project Description

kids.xml is a Python library providing helpers when writing xml thingy in python.

It’s part of ‘Kids’ (for Keep It Dead Simple) library.


This code is in alpha stage. It wasn’t tested on Windows. API may change. This is more a draft for an ongoing reflection.

And I should add this is probably not ready to show. Although, a lot of these function are used everyday in my projects and I got sick rewritting them for every project.


using kids.xml:

  • xml2string that actually works.


Tis code is python2 and python3 ready. It wasn’t tested on windows.


You don’t need to download the GIT version of the code as kids.xml is available on the PyPI. So you should be able to run:

pip install kids.xml

If you have downloaded the GIT sources, then you could add install the current version via traditional:

python install

And if you don’t have the GIT sources but would like to get the latest master or branch from github, you could also:

pip install git+

Or even select a specific revision (branch/tag/commit):

pip install git+


>>> from kids.file import tmpfile, rm
>>> f = tmpfile('<a x="2">Hi</a>')


Will load content fromn an xml file:

>>> from kids.xml import load

>>> xml = load(f)
>>> rm(f)
>>> xml
<Element a at ...>


Will output as string the content of an XML object (ElementTree from lxml):

>>> from __future__ import print_function
>>> from kids.xml import xml2string

>>> print(xml2string(xml))
<?xml version="1.0" encoding="utf-8"?>
<a x="2">Hi</a>

Note that the content is linted.


Will parse a string and return the XML ElementTree:

>>> from kids.xml import xmlize

>>> xmlize('<a x="2">Hi</a>')
<Element a at ...>


You can use kids.xml as a simple shortcut for handy xml functions:

>>> from kids.xml import quote_attr, quote_value

If you have to insert values into attribute you could use this to quote it:

>>> print(quote_attr("It's called \"Smith & Wesson\""))
"It's called &quot;Smith &amp; Wesson&quot;"

And if you have to insert plain text into XML, you could use this:

>>> print(quote_value("It's called \"Smith & Wesson\""))
It's called "Smith &amp; Wesson"


Any suggestion or issue is welcome. Push request are very welcome, please check out the guidelines.

Push Request Guidelines

You can send any code. I’ll look at it and will integrate it myself in the code base and leave you as the author. This process can take time and it’ll take less time if you follow the following guidelines:

  • check your code with PEP8 or pylint. Try to stick to 80 columns wide.
  • separate your commits per smallest concern.
  • each commit should pass the tests (to allow easy bisect)
  • each functionality/bugfix commit should contain the code, tests, and doc.
  • prior minor commit with typographic or code cosmetic changes are very welcome. These should be tagged in their commit summary with !minor.
  • the commit message should follow gitchangelog rules (check the git log to get examples)
  • if the commit fixes an issue or finished the implementation of a feature, please mention it in the summary.

If you have some questions about guidelines which is not answered here, please check the current git log, you might find previous commit that would show you how to deal with your issue.


Copyright (c) 2015 Valentin Lab.

Licensed under the BSD License.


0.0.1 (2015-02-05)

  • First import. [Valentin Lab]
Release History

Release History

This version
History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
kids.xml-0.0.1.tar.gz (5.5 kB) Copy SHA256 Checksum SHA256 Source Feb 5, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting