commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hookom, Jacob" <Jacob.Hoo...@redline.mckhboc.com>
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 [mailto:japtesta@indra.es] 
Sent: Monday, January 19, 2004 12:56 PM
To: Jakarta Commons Users List
Subject: Re: Digester's pattern matching: bug or misunderstanding?

Olaf.Meyer@nokia.com 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):
>
><my-sender>
>	<managed-object>
>		<descriptor/>
>	</managed-object>
></my-sender>
>
><my-sender>
>	<multi-dimension-object>
>		<managed-object>
>			<descriptor/>
>		</managed-object>
>		<other-dimension>
>			<descriptor/>
>		</other-dimension>
>	</multi-dimension-object>
></my-sender>
>
>I now have added the following rules:
>
>	digester.addObjectCreate("*/my-sender", Sender.Class);
>	digester.addObjectCreate("*/managed-object", ManagedObject.Class);
>	digester.addObjectCreate("*/multi-dimension",
MultiDimensionObject.Class);
>	digester.addObjectCreate("*/descriptor", Descriptor.Class);
>
>	digester.setNextRule("*/managed-object/descriptor",
"setDescriptor");
>	digester.setNextRule("*/other-dimension/descriptor",
"doSomethingElse");
>
>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
account.
>
>Is this a bug, or do I need more clarification on how the matching patterns
really influence digester's behavior? Comments are welcome.
>
>Olaf
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>  
>

----------------------------------------------------------------------------
---------------------------------------
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
e-mail

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message