You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Marc Gemis <ma...@agfa.com> on 2003/11/06 14:34:40 UTC
Re: [Digester] How to access created objects
Hallo Simon, Frank
Frank Schaare wrote
> yes, that was a little confusing to me. I actually saw some Java code
> before 'crawling' through the commons sources, but never this stack
> stuff. I just dealt with stacks by handling exceptions without any
need
> to get closer as e.printStackTrace(). I donĀ“t remenber any other class
> pushing and polling objects to/from stack, so i just expectet some
> methods like getStack(i) or whatever. Time to learn something new ;-)
The digester stack has nothing to do with the exception stack. They
both use a stack concept, i.e. a "box" where push objects on and where
you can (normally) only access the object you last put on the stack.
(cfr. a pile of papers). A stack is a Last-In-First-Out (LIFO-queue),
which is a standard programming concept.
Simon Kitching wrote
>The way digester is generally used is that you give it some rules and
>some input xml, and it generates a tree of objects. You never need to
>access the digester "stack" from your code; you just get the object
>representing the root of the tree and use its methods.
I actually used the digester stack to first push an object on the stack
containing some configuration settings. I need those settings to
complete the properties of the objects that are created during the
parsing. I use the Digester to parse incoming XML (not a config file),
but need to add values from the environment, which cannot be found in
the submitted XML document. The object that I first pushed on the stack
can then be accessed with a SetRootRule to set the values on the
created objects. Perhaps there is a better way.
regards
m
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org