SW> Please don't apply the patch, as having an empty qname is an essential
SW> part of the test!
SW> Having an empty qname is allowed by the SAX specification (again, see
SW> ContentHandler.startElement()'s javadoc), but some versions of Xalan
SW> (don't know about the current one) have a bug that lead to improper
SW> serialization if the qname is empty. And this is what is tested here.
Just some more thoughts, because now I'm kind of confused ;-)
I thought the test was to check if the namespace attribute will be
present, isn't it? The test checks if "xmlns:nsp='namespaceuri'" is
present?!
The Caucho transformer does accept an empty qName if the uri is also
empty.
If needsNamespacesAsAttributes returns true, the following calls to
startElement will be intercepted by NamespaceAsAttributes. There the
qualified name is only reconstructed, if the supplied uri is empty...
// try to restore the qName. The map already contains the colon
if (null != eltUri && eltUri.length() != 0 &&
this.uriToPrefixMap.containsKey(eltUri)) {
eltQName = (String) this.uriToPrefixMap.get(eltUri) + eltLocalName;
}
This will not solve the problem with empty qNames in all cases.
The Xalan-Bug seems to be fixed by the way:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1348
Some test results:
Running the original test with some Xalan (seems to be a buggy
version) leads to...
Result: </>
Conclusion: Trax handler org.apache.xalan.transformer.TransformerIdentityImpl
needs namespace attributes (will be slower).
Running the modified test with some Xalan...
Result: <nsp:element/>
Conclusion: Trax handler org.apache.xalan.transformer.TransformerIdentityImpl
needs namespace attributes (will be slower).
Running the modified test with Caucho...
Result: <nsp:element xmlns:nsp="namespaceuri"/>
Conclusion: Trax handler com.caucho.xsl.TransformerHandlerImpl handles
correctly namespaces.
I'm by no means into the code, but I thought that this issue might
could need some more revision and this could be helpful.
--
Thomas mailto:[EMAIL PROTECTED]