Hi Knut
 
This is a SAX / JAXP question really I guess but I'll try help. There's some similar code to do this already in dom4j. Its in SAXReader in the installXMLFilter method at line 579. The code block is...
 
   // add a new xmlFilter to the xmlReader's pipeline...
 
        XMLReader xmlReader;
 
        XMLFilter xmlFilter ...;
        if ( xmlFilter != null ) {
            // find the root XMLFilter
            XMLFilter root = xmlFilter;
            while (true) {
                XMLReader parent = root.getParent();
                if ( parent instanceof XMLFilter ) {
                    root = (XMLFilter) parent;
                }
                else {
                    break;
                }
            }
            root.setParent(xmlReader);
 
i.e. that the XMLReader is the topmost parent.
 
Does this help you at all?

James
----- Original Message -----
Sent: Sunday, April 07, 2002 8:12 AM
Subject: [dom4j-user] SAXResult with XMLFilter chain

Hi everyone,
 
I'm trying to transform an XML document via XSLT where the result of the tranformation gets postprocessed by an XMLFilter. I am using the dom4j and JAXP APIs. I do this by pushing the result of the transformation into a SAXResult that gets instantiated with the filter as argument. The actual filter is an object of class XMLWriter that writes its output into a StringWriter.
My problem: everything works fine when I use one XMLWriter to filter the SAX events. But I would like to chain filters to provide further processing of the transformation result. I tried to do this by calling the #setParent method with no success. I tried some other variations with no luck. No more than the filter is called that is passed in the SAXResult constructor.

Any ideas?

- Knut


Send and receive Hotmail on your mobile device: Click Here
_______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to