I'm currently trying to parse objects from an XML file to a hashtable. I'm
calling the put from the hashtable in my rule and passing 2 parameters one
that represents the key and the other that represents the value. For some
reason I'm getting a SAXException saying that the put method does not exist
on hashtable. Here's the code I'm working with currently. Any suggestions
would be greatly appreciated:
java.io.FileInputStream fileInputStream = null;
Digester digester = new Digester();
Hashtable ht = new Hashtable();
digester.push(ht);
digester.setValidating(false);
//Sets filed 1 as the key and field 2 as the value
digester.addCallMethod("toplevel/element", "put", 2);
digester.addCallParam("toplevel/element/field1", 0, "field1");
digester.addCallParam("toplevel/element/field2", 1, "field2");
try {
fileInputStream = new java.io.FileInputStream("C:/test.xml");
} catch (java.io.FileNotFoundException fnfe) {
}
try {
Object data = digester.parse(fileInputStream);
fileInputStream.close();
} catch (org.xml.sax.SAXException se) {
System.out.println(se.getMessage());
} catch (java.io.IOException ie) {
}
Here's the XML file that I'm parsing:
<toplevel>
<element>
<field1>Value 1</field1>
<field2>Value 2</field2>
</element>
<element>
<field1>Value 3</field1>
<field2>Value 4</field2>
</element>
</toplevel>
Thank you for any sugestions that you can provide...
Brad
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>