Showing posts with label lxml. Show all posts
Showing posts with label lxml. Show all posts

Saturday, June 29, 2013

Haciendo un XML con python.




Cómo crear un xml con python, de forma rápida
y sencilla, la mejor librería que se adapta a eso es:

lxml
ElementTree está genial, sin embargo
al momento de crearlo, lo generaba en
una sola línea :-/ lxml utiliza ElementTree
y un poco más :) Esta librería me permitió
 añadir nueva línea para cada tag,
de forma que quedara legible e identado. 
Resultado: GitHub Python Script
Comentadas están algunas otras que probé
pero su forma de crear el XML no se ajustaba a lo
que necesitaba.

Para formatear un XML, no muy grande:
http://www.freeformatter.com/xml-formatter.html

Enlaces de Referencia:
http://effbot.org/zone/element.htm
http://www.boddie.org.uk/python/XML_intro.html
http://docs.python.org/2/library/xml.etree.elementtree.html
http://luisartola.com/software/2010/easy-xml-in-python/
http://wiki.python.org/moin/PythonXml
http://docs.python.org/3.4/library/xml.etree.elementtree.html#module-xml.etree.ElementTree

Element Tree example:
http://pymotw.com/2/xml/etree/ElementTree/create.html
Este está completo, sobre lxml:
http://infohost.nmt.edu/tcc/help/pubs/pylxml/web/index.html