[Zope-dev] load_site.py: patch1 draft

Anthony Pfrunder s341625@student.uq.edu.au
Mon, 4 Oct 1999 09:03:50 +1000 (GMT+1000)


On Sun, 3 Oct 1999, Oleg Broytmann wrote:

[snip]

>    But next thing would not be so simple. I want to parse META tags, put
> them into properties (I do not see any better place) and will construct
> special version of standard_html_header that will loop over properties
> reconstructing <HEAD> with META tags.
>    Question. How can I loop over properties?

Hi!

You may wish to use the XMLWidgets+XMLDocument Products as these provide
what you are
after (and mine when I update it ;).  Basically, you can upload an XHTML
file (or HTML file with a little work) and then use the ZDOM methods to
query it.  Check out:

	lib/python/ZDOM.py -- Superclass for the Zope Document Object Model
	lib/python/Products/XMLDocument/Node.py -- XML DOM methods

For example, to get the properties of a tag:

	x = getElementByTagName('body')[0].getAttributes()
	for a in x:
		name = getName()
		value = getValue()

Cheers,

Anthony Pfrunder