Where's a DOM builder that uses the Builder Pattern to ... build DOMs?
Stefan Behnel
stefan_ml at behnel.de
Wed Jan 13 07:48:15 EST 2010
Phlip, 07.01.2010 17:44:
> 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.
Note how you imported 'E' from a package called 'lxml.html'. The last part
of that package name gives a hint on what it specialises in.
> So how to get it to generate any random XML tag my clients think of?
Have you thought of taking a look at the tutorial?
http://codespeak.net/lxml/tutorial.html#the-e-factory
Stefan
More information about the Python-list
mailing list