commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lafredo, Stephen" <stephen_lafr...@merck.com>
Subject Digester: Cannot get <call-param-rule> to parse?
Date Fri, 21 Mar 2003 22:16:47 GMT
Hi,

I am using the commons-digester-1.4.1 and I am have used the digester
feeding it an xml rules file to parse my xml file and all works fine. Now I
am trying to define a method with parameters and I cannot seem to get the
syntax correct.

My xml file contains...

  <ResourceParams name="jdbc/db2">
    <parameter>
      <name>factory</name>
      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    
    <!-- add remaining parameters here... -->
    
  </ResourceParams>

The corresponding portion of my rules file contains...

  <!-- Resource parameters are defined within the Context element and
       associated a Resource -->
  <pattern value="Context/ResourceParams">

    <object-create-rule
classname="org.apache.catalina.deploy.ResourceParams"
                        attrname="resourcesParameters"/>

    <!-- map the element's XML attributes to the bean properties -->
    <set-properties-rule>
      <alias attr-name="name" prop-name="name" />
    </set-properties-rule>

    <call-method-rule pattern="parameter"
                   methodname="addParameter"
                   paramcount="2">
      <call-param-rule param-index="0"
                    attribute-name="name" />               
      <call-param-rule param-index="1"      ^ - this is line 74, 45
                    attribute-name="value" />               
    </call-method-rule>                   

    <!-- add the ResourceParams to the Context -->
    <set-next-rule methodname="addResourceParams" />

  </pattern>
</digester-rules>

When I attempt to parse the file I receive these error messages...

Mar 21, 2003 5:02:42 PM org.apache.commons.digester.Digester startElement
SEVERE: Begin event threw exception java.lang.NumberFormatException: null
 	at java.lang.Integer.parseInt(Integer.java:394)
 	at java.lang.Integer.parseInt(Integer.java:476)
 	at
org.apache.commons.digester.xmlrules.DigesterRuleParser$CallParamRuleFactory
.createObject(DigesterRuleParser.java:532)
 	at
org.apache.commons.digester.FactoryCreateRule.begin(FactoryCreateRule.java:2
91) 


...and...


Application.start():  org.apache.commons.digester.xmlrules.XmlLoadException:
Error at (74, 45: null
 	at
org.apache.commons.digester.xmlrules.FromXmlRuleSet.addRuleInstances(FromXml
RuleSet.java:165)
 	at
org.apache.commons.digester.Digester.addRuleSet(Digester.java:1658)
 	at
org.apache.commons.digester.xmlrules.DigesterLoader.createDigester(DigesterL
oader.java:90) 



I looked at line 74, 45 and it "appears" to be correct?

Does anyone have any recommendations or could you please point me to the
rules file syntax documentation.

Thank you.


Stephen Lafredo


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments, contains information of Merck
& Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary
copyrighted and/or legally privileged, and is intended solely for the use of the individual
or entity named in this message.  If you are not the intended recipient, and have received
this message in error, please immediately return this by e-mail and then delete it.

==============================================================================


Mime
View raw message