commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hookom, Jacob" <>
Subject RE: Digester's pattern matching: bug or misunderstanding?
Date Mon, 19 Jan 2004 19:53:56 GMT
I believe the proper syntax is "**/my-sender", etc

-----Original Message-----
From: José Antonio Pérez Testa [] 
Sent: Monday, January 19, 2004 12:56 PM
To: Jakarta Commons Users List
Subject: Re: Digester's pattern matching: bug or misunderstanding? wrote:

>I'm currently writing an XML config file parser using the Digester
framework. I've spent quite a while debugging the digester code, since I
really did not understand how digester was building the object stack. I now
understand it but am wondering if this is a bug ...
>Here are the details. My XML document roughly has the following structure
(strongly simplified for demonstration purposes):
>	<managed-object>
>		<descriptor/>
>	</managed-object>
>	<multi-dimension-object>
>		<managed-object>
>			<descriptor/>
>		</managed-object>
>		<other-dimension>
>			<descriptor/>
>		</other-dimension>
>	</multi-dimension-object>
>I now have added the following rules:
>	digester.addObjectCreate("*/my-sender", Sender.Class);
>	digester.addObjectCreate("*/managed-object", ManagedObject.Class);
>	digester.addObjectCreate("*/multi-dimension",
>	digester.addObjectCreate("*/descriptor", Descriptor.Class);
>	digester.setNextRule("*/managed-object/descriptor",
>	digester.setNextRule("*/other-dimension/descriptor",
>With this setup the "Descriptor" object is *NOT* created, since the rules
associated with the longer
>"*/managed-object/descriptor" or "*/other-dimension/descriptor" matches are
executed before the ObjectCreateRule which is matched by "*/descriptor".
have you tried adding two different creational rules with the longer 
matches instead of current single rule? It seems like '*/descriptor' is 
not matching anything

>Digester now calls the "setDescriptor" method on a Sender instance instead
of on a ManagedObject instance.
>I would expect Digester to create the "Descriptor" object before doing
anything else with the object. It seems that digester does not handle rules
in the proper order. Some rules are clearly associated with the creation
(invoked in start() function) of an element (e.g. ObjectCreateRule). Other
rules (e.g. SetNextRule)  should be invoked after object creation (invoked
in end() function). However digester does not seem to take this into
>Is this a bug, or do I need more clarification on how the matching patterns
really influence digester's behavior? Comments are welcome.
>To unsubscribe, e-mail:
>For additional commands, e-mail:

Este correo electrónico y, en su caso, cualquier fichero anexo al mismo,
contiene información de carácter confidencial exclusivamente dirigida a su
destinatario o destinatarios. Queda prohibida su divulgación, copia o
distribución a terceros sin la previa autorización escrita de Indra. En el
caso de haber recibido este correo electrónico por error, se ruega notificar
inmediatamente esta circunstancia mediante reenvío a la dirección
electrónica del remitente.

The information in this e-mail and in any attachments is confidential and
solely for the attention and use of the named addressee(s). You are hereby
notified that any dissemination, distribution or copy of this communication
is prohibited without the prior written consent of Indra. If you have
received this communication in error, please, notify the sender by reply

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message