cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <>
Subject Re: Custom Transformer: attributes lost when serialized XML recording
Date Tue, 15 Jun 2004 12:10:26 GMT
Adam Ratcliffe wrote:

>I have a custom transformer that extends AbstractSaxTransformer for
>making XML-RPC
>calls.  It extracts a method call element from an input document and
>sends this to
>the remote service for processing.
>My problem is that when I use the startSerializedXMLRecording() method
>AbstractSaxTransformer to collect the method call fragment it records
>only and the namespace attribute on the top-level element is lost.
>This isn't a problem with the generator that creates the input document
>as I can
>see the attributes if I serialize the document after generation.
>Is there a configuration step that I'm missing?

I think you should maintain map of namespace declarations (by processing 
start/end namespace mapping event) and declare all namespaces when you 
start recording. Look around for code samples, I think there is 
something similar in other transformers.


>public void startElement(String uri, String name, String raw, Attributes
> throws SAXException {
> if (name.equals(XMLRPC_REQUEST_ELEMENT)) {
>     this.stack.push("end");
> } else if (name.equals(XMLRPC_SERVICE_ELEMENT)){
>            this.startTextRecording();     
> } else if (name.equals(XMLRPC_METHOD_CALL_ELEMENT)) {
> } else {
>            super.startElement(uri, name, raw, attr);
>        }
>    }

View raw message