Firstly, I'm not sure a leading slash is allowed on a pattern. It
certainly was not in old digester versions.
And in xmlrules when a pattern element is nested inside another, the
inner pattern is prefixed by the outer pattern. So you should use:
<pattern value="country/companies/company/resources">
<pattern value="resource">
...
I recommend turning on debug-level logging output for digester. This
will show what rules are matching and being executed. Digester uses
commons-logging.
Regards,
Simon
On Mon, 2007-11-19 at 13:20 -0800, akiraleon123 wrote:
> Hi Jared,
> it is pushed on the java side as the first element.
>
> Digester d = DigesterLoader.createDigester(rulesURL);
>
> ArrayList a = new ArrayList();
>
> d.setStackAction(new DigesterCallBack());
>
> d.push(a);
>
> // Process the input file.
> try {
> java.io.File srcfile = new java.io.File(datafileName);
> d.parse(srcfile);
> //System.out.println(aL);
>
> }
> a. size is 0 at this point.
>
>
> thanks.
> akira.
>
>
>
> Jared Graber wrote:
> >
> > Akira,
> >
> > Unless I didn't get the entire msg, I don't see an ArrayList being
> > created so I'm not sure how you are getting an ArrayList as a result.
> >
> > -Jared
> >
> > akiraleon123 wrote:
> >> Hi All,
> >> The following is my xml file that i am trying to load into Resource
> >> objects
> >> and store into an arraylist. But my arraylist is empty. I believe it has
> >> got
> >> sth to do with the pattern i am using. I 'd appreciate your help.
> >>
> >>
> >> <country>
> >> <companies>
> >> <company name="abc">
> >> <resources>
> >>
> >> <resource name="pete" type="human"/>
> >> <resource name="tim" type="human"/>
> >>
> >> </resources>
> >> </company>
> >> </companies>
> >> </country>
> >>
> >>
> >> ***********
> >>
> >> The following is the digetser rules file.
> >>
> >>
> >> <digester-rules>
> >> <pattern value="/country/companies/company/resources">
> >>
> >> <pattern value="/country/companies/company/resources/resource">
> >>
> >> <object-create-rule classname="Resource"/>
> >>
> >>
> >> <set-next-rule methodname="add" />
> >>
> >> <set-properties-rule >
> >> <alias attr-name="name" prop-name="name" />
> >> </set-properties-rule>
> >>
> >>
> >> </pattern>
> >> </pattern>
> >> </digester-rules>
> >>
> >>
> >> My class file:
> >>
> >> class Resource{
> >> private String name;
> >> //getters, setters
> >> }
> >>
> >> thanks,
> >> akira.
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]