cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andre Juffer <>
Subject Namespace, Custom Transformer
Date Sun, 30 Sep 2007 13:28:47 GMT
Hi All,

I have some trouble with a custom transformer that needs to create a DOM 
  document from SAX events. This transformer (XACMLTransformer) is used 
to send a XACML request to a so-called Policy Decision Point PDP (see for for 
background information).

A typical request with name spaces looks like:

<xacml:request xmlns:xacml="something-here">
<Request xmlns="urn:oasis:names:tc:xacml:2.0:context:schema:os"

Everything from <Request> to </Request> is entirely valid XACML-XML 
according to the schema located at
This Request is in fact send to the Policy Decision Point (PDP).

The element xacml:request element triggers the XACMLTransformer. The 
transformer extends from the 
org.apache.cocoon.transformation.AbstractSAXTransformer but only 
implements the ContentHandler interface. All SAX events it receives are 
forwarded to an org.apache.cocoon.xml.dom.DOMBuilder. As soon as 
everything has been processes, the request Document is send to the PDP.

So far so good.

The problem now is that as soon as the Request element is processed, the 
  xmlns="urn:oasis:names:tc:xacml:2.0:context:schema:os" part results in 
an exception of the form:

ERROR: NAMESPACE_ERR: An attempt is made to create or change an object 
in a way which is incorrect with regard to name spaces.
at org.apache.xml.utils.DOMBuilder.startElement(

The referred line in DOMBuilder contains the following (from the xalan 
// In SAX, xmlns[:] attributes have an empty namespace, while in DOM
// they should have the xmlns namespace
if (attrQName.startsWith("xmlns:") || attrQName.equals("xmlns")) {
   attrNS = "";
(attrQName is a String).

I cannot see what the problem in fact is.

However, if all name spaces of the Request element above are placed in 
the xacml:request element instead, everything is fine. In fact, as long 
as there are no namespace in the Request, everything works. I can view 
the request Document that is send to the PDP and it is an exact copy of 
<Request> to </Request> as it should be. The PDP properly evaluates the 
request and a response is accordingly generated. The response is 
converted into DOM, which is subsequently inserted into the pipeline.

I need to be able to employ name spaces also within the Request part. 
ANd this seems not possible. I am sure I do something wrong.

I have 3 questions:
1. Should all name spaces always be in the triggering element 
2. What could be the interpretation of the aforementioned NAMESPACE_ERR 
exception? The W3C document is very unclear, to say the least.
3. Is there a thinking error on my part in the sense that I do things 
incorrectly for the XACMLTransformer?

Thanks for your help,

Andre H. Juffer              | Email:
The Biocenter and            | WWW:
     the Dep. of Biochemistry | Fax: +358-8-553-1141
University of Oulu, Finland  | Phone: +358-8-553 1161

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message