commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Saremi <jeffsar...@yahoo.com>
Subject [Digester] AddressBook example does not work!
Date Wed, 27 Apr 2005 15:35:46 GMT

Digester version: 1.6
JDK: 1.4.2

Has anyone tries running the AddressBook example in
the CVS under "xmlrules"? We I did and it does not
work. Here's the output. Compare it with the input XML
which i copied below (and the parser rules.xml):


Address book has 2 entries
Person #1
  category=acquaintance
  name=Gonzo
  email (type business) : gonzo@muppets.com
  address type: null
    null
    null null null
    null
  address type: null
    null
    null null null
    null
Person #2
  category=rolemodel
  name=Kermit
  email (type business) : kermit@muppets.com
  email (type home) : kermie@acme.com
  address type: null
    null
    null null null
    null


Example.xml:
<address-book>
  <person id="1" category="acquaintance">
    <name>Gonzo</name>
    <email type="business">gonzo@muppets.com</email>
    <address>
      <type>home</type>
      <street>123 Maine Ave.</street>
      <city>Las Vegas</city>
      <state>NV</state>
      <zip>01234</zip>
      <country>USA</country>
    </address>
    <address>
      <type>business</type>
      <street>234 Maple Dr.</street>
      <city>Los Angeles</city>
      <state>CA</state>
      <zip>98765</zip>
      <country>USA</country>
    </address>
  </person>

  <person id="2" category="rolemodel">
    <name>Kermit</name>
    <email type="business">kermit@muppets.com</email>
    <email type="home">kermie@acme.com</email>
    <address>
      <type>business</type>
      <street>987 Brown Rd</street>
      <city>Las Cruces</city>
      <state>NM</state>
      <zip>75321</zip>
      <country>USA</country>
    </address>
  </person>

</address-book>


xmlules.xml:
<digester-rules>
  <pattern value="address-book">
    <pattern value="person">
      <object-create-rule classname="Person"/>
      <set-properties-rule/>
      <set-next-rule methodname="addPerson"/>
      
      <pattern value="name">
        <call-method-rule methodname="setName"
paramcount="0"/>
      </pattern>
      
      <pattern value="email">
        <call-method-rule methodname="addEmail"
paramcount="2"/>  
        <call-param-rule paramnumber='0'
attrname='type'/>
        <call-param-rule paramnumber='1'/>
      </pattern>
      
      <pattern value="address">
        <object-create-rule classname="Address"/>
        <set-nested-properties-rule/>
        <set-next-rule methodname="addAddress"/>
      </pattern>
      
    </pattern>
  </pattern>
</digester-rules>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message