hi brad
i've given your code a whirl but i don't seem to have a problem.
what version of digester are you using?
BTW i would be useful if you could prefix your question with the component
name next time. (there are a lot of components in commons and the prefix
makes it easier for the right people to answer the right questions.)
- robert
On Monday, July 8, 2002, at 08:04 PM, Brad Jones wrote:
>
>
> 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].
> org>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED].
> org>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>