Where's a DOM builder that uses the Builder Pattern to ... build DOMs?

Phlip phlip2005 at gmail.com
Thu Jan 7 17:44:25 CET 2010


On Jan 7, 5:36 am, Stefan Behnel <stefan... at behnel.de> wrote:

> Well, then note that there are tons of ways to generate XML with Python,
> including the one I pointed you to.

        from lxml.html import builder as E
        xml = E.foo()

All I want is "<foo/>", but I get "AttributeError: 'module' object has
no attribute 'foo'".

A peek at dir(E) shows it only has HTML tags, all hard coded.

So how to get it to generate any random XML tag my clients think of?

I will write this myself with __getattr__ etc, if I can't find it,
because the permissive & expressive builder pattern I'm after would be
very ... permissive & expressive.

All I want is a library that reads my mind!!! Is that too much to
ask??? (Unless if the library insists on throwing a NullMind
exception, on principle...)

--
  Phlip
  http://twitter.com/Pen_Bird



More information about the Python-list mailing list