Because ZCML is XML, and because XML requires a single root tag for
each document, every ZCML file used by Pyramid must contain a
container directive, which acts as the root XML tag. It is a "container"
directive because its only job is to contain other directives.
- The default XML namespace used for subdirectives.
1 2 3 4 5
<configure xmlns="http://pylonshq.com/pyramid"> <!-- other directives --> </configure>
A Word On XML Namespaces¶
Usually, the start tag of the
<configure> container tag has a
default XML namespace associated with it. This is usually
http://pylonshq.com/pyramid, named by the
xmlns attribute of
configure start tag.
http://pylonshq.com/pyramid namespace as the default XML
namespace isn't strictly necessary; you can use a different default namespace
as the default. However, if you do, the declaration tags which are defined
by Pyramid such as the
view declaration tag will need to be defined in
such a way that the XML parser that Pyramid uses knows which namespace the
pyramid tags are associated with. For example, the following files
are all completely equivalent:
Use of A Non-Default XML Namespace
1 2 3 4 5 6 7 8 9 10
<configure xmlns="http://namespaces.zope.org/zope" xmlns:pyramid="http://pylonshq.com/pyramid"> <include package="pyramid.includes" /> <pyramid:view view="helloworld.hello_world" /> </configure>
Use of A Per-Tag XML Namespace Without A Default XML Namespace
1 2 3 4 5 6 7 8 9
<configure> <include package="pyramid.includes" /> <view xmlns="http://pylonshq.com/pyramid" view="helloworld.hello_world" /> </configure>
For more information about XML namespaces, see this older, but simple XML.com article.
The conventions in this document assume that the default XML namespace