Some further investigation shows that this is the default behaviour of
the SAX parser to not pass in the
namespace attribute with the rest of the element attributes in
startElement().
I set the parser namespace-prefixes feature property to 'true' in
cocoon.xconf to allow the namespace
attribute to be passed through.
I'm still not seeing the namespace attribute when I output the document
fragment from endSerializedXMLRecording().
Any ideas?
Cheers
Adam
-----Original Message-----
From: Adam Ratcliffe [mailto:adam@premasys.com]
Sent: Tuesday, 15 June 2004 11:03 a.m.
To: dev@cocoon.apache.org
Subject: Custom Transformer: attributes lost when serialized XML
recording
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
from AbstractSaxTransformer to collect the method call fragment it
records elements 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?
public void startElement(String uri, String name, String raw, Attributes
attr)
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)) {
this.startSerializedXMLRecording(XMLUtils.defaultSerializeToXMLFormat(tr
ue));
} else {
super.startElement(uri, name, raw, attr);
}
}
|