commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Naresh Bhatia" <>
Subject [Digester] How to specify a <call-param-rule> parameter from top-of-stack
Date Fri, 24 Jan 2003 05:44:07 GMT
I am trying to parse an XML file similar to the one shown below:

  <product partNumber="1000">
  <product partNumber="2000">

I want Digester to return a HashMap with partNumber as the key and
product as the value. How do I put the product on to the HashMap? I
guess I don't know how <call-param-rule> can specify the object from top
of the stack as a parameter. Here's my unsuccessful attempt at this:

  <object-create-rule pattern="products" classname="java.util.HashMap"/>

  <pattern value="products/product">
    <object-create-rule classname="Product"/>

      <alias attr-name="partNumber" prop-name="partNumber"/>

    <call-method-rule methodname="put" paramcount="2"
    <call-param-rule paramnumber="0" attrname="partNumber"/>
    <call-param-rule paramnumber="1"/>  <--- what to do here?


Naresh Bhatia

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message