DTD Parsing

Christian Heimes lists at cheimes.de
Tue Nov 9 22:02:34 EST 2010


Am 10.11.2010 03:44, schrieb Felipe Bastos Nunes:
> I'd like to know too. I work with java and jdom, but I'm doing
> personal things in python, and plan to go full python in the next 2
> years. Xml is my first option for configuration files and simple
> storages.

Don't repeat the mistakes of others and use XML as a configuration
language. XML isn't meant to be edited by humans. It's my strong believe
that XML is great for stuff like data exchange and long time data
storage, but not for configuration.

Python has much more suited ways to deal with configuration. At work we
used to have XML for configuration years ago. Today we use configobj
[1], a ini style config system with config specs, validation and many
more features. You can define a setting as e.g. list of ints and you
actually get a list of ints from the resulting config object.

Back to the initial question: I highly recommend LXML for any kind of
XML processing, validation, XPath etc. It's super fast, extremely
powerful and supports all features of libxml2 and libxslt. It also
supports DTD, RelaxNG and XML schema.

Christian

[1] http://pypi.python.org/pypi/configobj
[2] http://pypi.python.org/pypi/lxml




More information about the Python-list mailing list