Hi,
I posted a mail about a problem using the combination of the TraxTransformer
and the FragmentExtractor on this list a while ago.
Now I finally tracked it down.
It's a problem of the combination. When an element starts without being
associated with a namespace, the uri parameter to startElement() is an
empty String if called e.g. by FileGenerator. If called after the
TraxTransformer it is NULL, what triggers a NPE and causes the pipeline
to be aborted.
Here is an example for the changes made by the TraxTransformer (when using
a simple "copy-everything" stylesheet):
---cut---
[startDocument]
-[startElement] uri=,local=root,raw=root
+[startElement] uri=null,local=root,raw=root
[characters]
---cut---
Concluions:
- I append a patch to FragmentExtractor, that avoids a NPE to be thrown.
- Although this problem is solved with the patch alone, the TraxTransformer
(respectivly the underlying xalan (?)) should be modified to return an
empty string instead of NULL, to provide a more consistent calling
pattern (or is the value NULL to be expected in such a case ?).
I'd be happy if the patch would be incorporated.
---cut---
diff -u -r1.3.2.2 FragmentExtractorTransformer.java
--- src/org/apache/cocoon/transformation/FragmentExtractorTransformer.java
2001/08/20 14:07:34 1.3.2.2
+++ src/org/apache/cocoon/transformation/FragmentExtractorTransformer.java
+2001/09/13 20:23:18
@@ -163,7 +163,7 @@
*/
public void startElement(String uri, String loc, String raw, Attributes a)
throws SAXException {
- if ( uri.equals(this.EXTRACT_URI) && loc.equals(this.EXTRACT_ELEMENT) ) {
+ if ( this.EXTRACT_URI.equals(uri) && this.EXTRACT_ELEMENT.equals(loc) ) {
extractLevel++;
imageID++;
getLogger().debug("FragmentExtractorTransformer extractLevel now " +
extractLevel + ".");
---cut---
Greg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]