On Fri, 2004-09-17 at 08:28, Jim Henderson wrote: > Topic: parsing complex objects using Java SAX > Developer background: newbe > > I have data stream that contains complex objects (call this CO1). The object > contains sub-structures (call this SS1) that are used by other complex > objects (CO2). Furthermore the sub-structures themselves may at times be > standalone objects. > > I would like to write a content handler that can process the sub-structures > when they are standalone. I would like to reuse the sub-structures content > handler when processing to more complex object from its content handler. > > The examples I have seen chain the XMLReaders content handler for CO1 to use > the content handler for SS1 at the startElement() method. So far so good! > But the ugly stuff occurs in the content handler for the sub-structure SS1. > The SS1 content handler endElement() method needs to know its parent wrapper > ends. At that point the XMLReader content handler is returned to the parent > object. > > Is there an example of another solution? > > By NO means am I trying to discredit the author of the article. He has > presented the only solution I have seen after a day of searching. I am > thankful for his work but I am wondering if there is a different solution to > the problem. > > Referenced article: > http://www.javaworld.com/javaworld/jw-08-2000/jw-0804-sax-p5.html
I don't fully understand your problem description, but perhaps it would be worth having a look at http://jakarta.apache.org/commons/digester in which "rule sets" can be defined to parse various xml structures. Regards, Simon --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]