On 10/17/06, Allen,Eva <[EMAIL PROTECTED]> wrote:


I'm attempting to write a small parser as part of another larger
application.  I'd like to do something like the following:

public class Parser {

...
        ClassA s = new ClassA();
        Digester d;
        d.push(s);
      ...
        d.parse(inputStream);
      ...
}
class ClassA {
   LinkedList ClassB;
   public void addClassB();
}
class ClassB {
  String data1;
  String data2;
  String data3;
  public getters and setters;
}

I'm using an xmlrules file looks like
<digester-rules>
...
   <pattern value="resolver">
        <object-create-rule classname="ClassB" />
        <set-properties-rule />
        <set-next-rule methodname="addClassB" />

        <pattern value="data1">
                <call-method-rule methodName="setData1" paramCount="0"
/>
      </pattern>
        ...
   </pattern>
...
</digester-rules>

This all works fine as long as ClassA and ClassB are public classes.
But as soon as I try to make them inner classes of the Parser class this
fails with an IllegalAccessException (Cannot access a member of class
ClassB with modifiers "").


This should be fine as long as your inner classes are both public and
static.

--
Martin Cooper


The Digester Developer Guide mentions something about this as a known
limitation and says to ask on the mailing list if I think I'm
experiencing the problem it mentions.  So I'm asking.  Is there a way
around this or am I forced to have public classes for use with the
digester?

Since I originally wrote this I've found that I could use the
FactoryCreateRule to create an object that doesn't have a no-argument
constructor, but I haven't been able to find a proper ruleset that will
allow me to do this.  Any suggestions?
--
Eva Allen
Consulting Software Engineer, OCLC, Inc.
6565 Frantz Rd., Dublin, OH  43017
614.764.6009 | [EMAIL PROTECTED]
Views contained herein are my own; they do not necessarily reflect those
of my employer


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


Reply via email to