While working my way toward integrating xindice into the BELTS runtime environment I came across this little problem. The namespace attributes were being emitted twice.
Source Document <test xmlns="http://example.com/test-1"> Content emitted by getContentAsSAX <test xmlns="http://example.com/test-1" xmlns="http://example.com/test-1"> After some digging (and a few new test cases) I found that the hasSaxNamespacesPrefixes of the SAXEventGenerator and XMLResourceImpl have incorrect default values (according to http://www.saxproject.org/apidoc/org/xml/sax/package-summary.html#package_description) This patch corrects this and adds the additional test cases I used to track the problem down. It does add an addition jar dependency for the test cases though. XMLUnit. XMLUnit provides better testing of document structure than just string comparisons. Patch can be found in bugzilla http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21535 -k.