cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andre Juffer <ajuf...@sun3.oulu.fi>
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 
http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=xacml 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"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="urn:oasis:names:tc:xacml:2.0:context:schema:os 
http://docs.oasis-open.org/xacml/access_control-xacml-2.0-context-schema-os.xsd">
......
</Request>
</xacml:request>

Everything from <Request> to </Request> is entirely valid XACML-XML 
according to the schema located at 
http://docs.oasis-open.org/xacml/access_control-xacml-2.0-context-schema-os.xsd
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(DOMBuilder.java:354)
...

The referred line in DOMBuilder contains the following (from the xalan 
source):
// 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 = "http://www.w3.org/2000/xmlns/";
}
(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 
(xacml:request)?
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: Andre.Juffer@oulu.fi
The Biocenter and            | WWW: www.biochem.oulu.fi/Biocomputing/
     the Dep. of Biochemistry | Fax: +358-8-553-1141
University of Oulu, Finland  | Phone: +358-8-553 1161

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message