At 2005-05-20 23:58, Simon Kitching wrote:
On Fri, 2005-05-20 at 14:22 +0200, Mattias J wrote:
> It was a while since I worked with Digester, so there might be a more
> straightforward way to call static methods which I have forgotten, but
> otherwise couldn't you use a factory-create-rule which could then access
> the file name through it's parameter
>    public Object createObject(Attributes attributes)

Unfortunately, FactoryCreateRule expects an object to be returned which
it then pushes on the stack. But in Magnus' case, there isn't any
suitable object to return as far as I can see.

My idea was that he'd just return the string "Foo" or the filename or something. But I forgot this was the first element in the file, which would cause problems as to what would be returned by Digester. (One could theoretically create a List and place the "Foo" string and what else is created by the digester in the list, and just ignore the initial "Foo" element, but...)

I think a custom Rule class is a tidier solution though..

... I agree, but I couldn't remember the XML syntax for that either.
Looking through some old files I see I have once tried creating a set of rules using org.apache.commons.digester.xmlrules.DigesterRulesSource and the <include class="..." /> tag.

/Mattias Jiderhamn

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

Reply via email to