commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <si...@ecnetwork.co.nz>
Subject Re: call-method-rule no longer working
Date Sun, 25 Jul 2004 03:49:59 GMT
On Fri, 2004-07-23 at 21:06, Karl Stenerud wrote:
> I'm having problems trying to upgrade from Digester 1.3 to 1.5 (1.4 and 1.4.1 also don't
work).
> 
> I've built a web app that runs under Tomcat (5.0.16).  I use Digester to parse the controller
configuration.
> With Digester 1.3, all works fine.  With any digester after that, it fails when it tries
to load the controller rules file:
[snip]
> I've checked the controller-config-rules.xml file and it is no longer valid under the
dtd that is provided with the new digester.
> A DTD check fails on call-method-rule with error: The content of element type "call-method-rule"
must match "EMPTY"
> Here is the offending fragment:
>     <pattern value="security-manager">
>       <call-method-rule pattern="property" methodname="addProperty" paramcount="2">
>         <call-param-rule paramnumber="1" attrname="name"/>
>         <call-param-rule paramnumber="2" attrname="value"/>
>       </call-method-rule>
>     </pattern>
> 
> And sure enough, the DTD does not allow call-param-rules inside of call-method-rules:
> <!-- CallMethodRule -->
> <!ELEMENT call-method-rule EMPTY>
> <!ATTLIST call-method-rule
>     pattern    CDATA #IMPLIED
>     methodname CDATA #REQUIRED
>     paramcount CDATA #IMPLIED
>     paramtypes CDATA #IMPLIED>
> 
> <!-- CallParamRule -->
> <!ELEMENT call-param-rule EMPTY>
> <!ATTLIST call-param-rule
>     pattern  CDATA #IMPLIED
>     paramnumber CDATA #REQUIRED
>     attrname CDATA #IMPLIED>
> 
> 
> The release notes mention that 1.4 broke compatibility with older versions, but there
wasn't anything mentioned about call-method-rule being changed.
> Is there something else I can use in its place to get the same effect?

Hi,

The call-method-rule element has *never* allowed call-param-rule
elements to be nested inside it. The DTD from CVS version 1.4 (which is
in Digester release 1.3) is the same in this regard as the latest
version.

The syntax for using call-method-rule with the xmlrules module is:
  <pattern value="security-manager">
    <call-method-rule methodname="add" paramcount="2"/>
    <call-param-rule paramnumber="1" .../>
    <call-param-rule paramnumber="2" .../>
  </pattern>

Yes, it would make some sense for the call-param-rule elements to be
children of the call-method-rule. But that's not how it's done when
building a set of rules using the Java API, and the xmlrules module
reflects this by making the call-param-rule elements *follow* the
call-method-rule element rather than be children of it.

There have been no significant changes to the way that CallMethodRule
and CallParamRule classes work (or their xmlrules equivalents), only
some new features added.

If you still are having problems after correcting the xmlrules
configuration file, please post again.

Regards,

Simon



---------------------------------------------------------------------
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