[Zope3-dev] Zope 3 Source organization
Shane Hathaway
shane@zope.com
Mon, 14 Jul 2003 17:12:39 -0400
Steve Alexander wrote:
> > I avoided XML
>
>> namespaces, used elements instead of attributes,
>
>
> I can't see that you used elements instead of attributes in any way that
> is different from zcml.
>
> The original discussion about zcml was of whether to put text in
> elements or in attributes. So rather than this:
>
> <mapper name="AccessControl.User.UserFolder"
> extends="base" parent="root">
>
> ...the argument was for this kind of thing:
>
> <mapper>
> <name>AccessControl.User.UserFolder</name>
> <extends>base</extends>
> <parent>root</parent>
>
> I'm glad you've chosen to put text in attributes rather then elements
> for ape config. I expect to use ape in the future, and I find this style
> easier to read.
I agree. The RDF spec makes it clear that you can consider XML
attributes to be shortcuts for elements.
What I meant to say is that the configuration vocabulary uses child
elements in some places where a ZCML namescape would prefer an
attribute. A ZCML-like configuration would have been written this way:
<mapper name="DTMLMethod" extensions=".dtml .dtm" />
Instead, I wrote it like this:
<mapper name="DTMLMethod">
<use-for extensions=".dtml .dtm" />
</mapper>
I think the latter helps differentiate registrations from declarations.
<mapper> is a declaration while <use-for> is a registration.
> > allowed elements in elements,
>
> zcml allows this, but only to a single level. I'd like to change this,
> and have some plans for doing so, but I doubt I'll ever get around to
> even prototyping it :-/
I think I found a nice way to do this. It involves registering XML
element handlers with an XML parser. The handlers are pretty easy to write.
Shane