yf***@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote in message news:<41******@news.victoria.tc.ca>...
timothy ma and constance lee (ti******@shaw.ca) wrote:
: i have an xml file like
: <node type="Service" key="1">
: <value>Title</value>
: </node>
: <node type="Service" key="2">
: <value>CA</value>
: </node>
[... snip ...]
-3-
I bet there are prepackaged ways to do this, so I'm interested to hear
what other suggestions are made.
I got the impression there are a couple of packages to do this.
We've been using XmlBeans,
http://xmlbeans.apache.org
You can create a simple XML schema that describes your elements, then
use the XmlBeans generated API to read and access you document.
example:
NodesDocument doc = NodesDocument.Factory.parse(inputStream);
Nodes nodes = doc.getNodes();
Node[] nodeList = nodes.getNodeArray();
for (int i=0; i<nodeList.length; ++i) {
nodeList[i].getType();
nodeList[i].getKey();
nodeList[i].getValue();
}
I think it's DOM based, not SAX.
Later,
Paul
--
Paul Webster
"Marg! Marg! The Doll's tryin' to kill me and the toaster's been
laughin'
at me!!" - Homer