I'm using Digester to map my XML file to my Java class, Restaurant.
Restaurant has a number of instance variables, most of which are Strings,
but some are ints. Digester is successfully calling the Restaurant setter
methods for the String instance variables, but it throws an exception
whenever it tries to call a setter method for an instance variable of type
int. For example, when it tries to call Restaurant.setId, it throws a
java.lang.NoSuchMethodException: No such accessible method: setId() on
object: Restaurant. I can work around this: If I change the setId method to
take a String and then use Integer.parseInt() to assign id, then I do not
get the error. But according to the AddressBook sample that came with
Digester, Digester should be converting all Strings it encounters in the XML
file to the appropriate types specified by the setter method signatures of
Restaurant, but obviously it isn't. Any help?

Thanks!

josh


Here is an excerpt from the XML file I'm parsing:


<restaurants>
  <restaurant>
    <id>0</id>
    <name>My Restaurant</name>
    <address>123 Sesame Street</address>
    <city>Cityville</city>
    <zip>12345</zip>
    <phone>(123) 123-4567</phone>
    <link>http://myrestaurant.com</link>
    <image>myrestaurant.jpg</image>
    <comments>blah blah blah</comments>
    <area_id>5</area_id>
    <map_x>6</map_x>
    <map_y>189</map_y>
    <categories>
      <category>American</category>
      <category>French</category>
    </categories>
  </restaurant>
  ...
</restaurants>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to