From: Ian Schneider <Ian.Schneider@ar...> - 2003-03-26 00:20:34
On IRC I said I'd put together a silly demo showing how a heirarchical
data structure could be visited and written to XML.
This came out far more elegant than planned.
The source (and classes) are here:
There are two classes representing data.
Feature and Attribute.
A Feature is an Attribute.
A Feature has Attributes.
Thus we set up the hierarchy.
Attribute follows the visitor pattern with the interface
WalkingVisitor implements AttributeVisitor and ensures a depth first
WalkingVisitor delegates the traversal to another interface
FeatureReader is an XMLReader with a one argument constructor containing
It contains a method called transform(OutputStream out) which will
produce XML to the given OutputStream.
To execute it, use TestDriver.
Direct questions hither.