On 27.08.2007 4:17 Uhr, Leszek Gawron wrote:

ok, int this case cocoon template behaves properly:
<root xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>
    <foo:foo xmlns="http://foor.org/bar/1.0";>
        <something/>
    </foo:foo>
    <foo:foo>
        <something/>
    </foo:foo>
</root>

raises an SAXParseException.

I guess it does not even get to the templating stuff. It's the XML parser that should complain.

what about this one:

<root xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>
    <foo:foo xmlns="http://foo.org/bar/1.0";>
        <something/>
    </foo:foo>
    <foo:foo xmlns="http://muu.org/foo/2.0";>
        <something/>
    </foo:foo>
</root>

I get also org.xml.sax.SAXParseException: The prefix "foo" for element "foo:foo" is not bound.

this works properly (switched default namespace to foo namespace):
<root xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>
    <foo:foo xmlns:foo="http://foo.org/bar/1.0";>
        <something/>
    </foo:foo>
    <foo:foo xmlns:foo="http://muu.org/foo/2.0";>
        <something/>
    </foo:foo>
</root>

It's twice the expected behavior. In the first example the default namespace is set, but prefix foo is not bound. In the second it is. It is as simple as this: A namespace declaration for a particular prefix must be declared either on the element with the prefix or on one of its ancestors (parents) to be in scope.

Joerg

Reply via email to