Nested XMLReader Only Seeing Root
Posted on 2002-03-23
I have a situation where I have a large number of XML files that refer to each other in a nested fashion. Each time a reference elemnt (ref.element) is encountered, I need to follow it's pointer attribute (refid) to the corresponding and include the contents of that new file with the current file contents. It's like a depth-first traversal of a tree.
I've coded a Walker class that extends XMLFilterImpl that recursively follows these links by creating a new instance of itself. It correctly fires all of the SAX events that I have coded for the class, but the other XMLReaders that I have chained to the "root instance" only get the events from the root file processing.
For my application, I'm attaching an XSLT processor to the reader and it is only processing results from the root file.
I've include a simplifed source to illustrate what I want to do. I'll post some of my code if anyone wants to see it.
Four input files...
<ref.element refid='1' />
<ref.element refid='2' />
<ref.element refid='3' />