Hello, I'm new to Digester, Tomcat, Servlet, Velocity, and even Java... Yup, one of those.
I am running into a spot of bother while using Digester to parse my XML file that I will ultimately pluck from Derby. The file starts out like this: <Screen> <ScreenID>3220D03D-59F7-49ca-86AE-E97B7427BA7B</ScreenID> <Lifetime_ms>20000</Lifetime_ms> <BugItem> <ImageURL>cnn001.jpg</ImageURL> ... It is a rather large file with many Vectors and I parse it just fine so long as all the setMethods are of type String. I am using XML Rules and my file looks like this: <?xml version="1.0"?> <digester-rules> <pattern value="Screen"> <object-create-rule classname="com.synergy.screendoc.ScreenDocument" /> <call-method-rule pattern="ScreenID" methodname="setScreenID" paramcount="0" /> <call-method-rule pattern="Lifetime_ms" methodname="setLifetime_ms" paramcount="0" /> ... My Java bean for the first level looks like this: public class ScreenDocument { public String ScreenID; public String Lifetime_ms; public Vector BugItem; public Vector StaticTextItem; public Vector DynamicTextItem; public ScreenDocument() { BugItem = new Vector(); StaticTextItem = new Vector(); DynamicTextItem = new Vector(); } public String getScreenID() { return ScreenID; } public void setScreenID( String rhs ) { this.ScreenID = rhs; } public String getLifetime_ms() { return Lifetime_ms; } public void setLifetime_ms( String rhs ) { this.Lifetime_ms = rhs; } ... The problem that I am encountering is that if I try to use bean-property-setter-rule like this: <?xml version="1.0"?> <digester-rules> <pattern value="Screen"> <object-create-rule classname="com.synergy.screendoc.ScreenDocument" /> <set-properties-rule/> <bean-property-setter-rule pattern="ScreenID"/> <bean-property-setter-rule pattern="Lifetime_ms"/> I get the Digester exception that the bean has no property ScreenID. Having a method that works I would normally just blow this off, but I don't really want Lifetime_ms to be a String, I want it to be an "int". I would be happy with it being a java.lang.Integer, but when I do something like this: <?xml version="1.0"?> <digester-rules> <pattern value="Screen"> <object-create-rule classname="com.synergy.screendoc.ScreenDocument" /> <call-method-rule pattern="ScreenID" methodname="setScreenID" paramcount="0" /> <pattern value="Lifetime_ms"> <call-method-rule methodname="setLifetime_ms" paramcount="1"/> <object-param-rule paramnumber='0' type="java.lang.Integer" /> </pattern> ... And change the bean to have Lifetime_ms defined, set, and returned as type Integer, Digester throws and exception and complains that setLifetime_ms is not defined in my class. I am at a loss for understanding why I am having this problem and suspect I am doing something really dumb. Can anyone please set me staight? Thank you in advance. Will