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 ...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
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".
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
------------------------------------------------------------------------------------------------------------------- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
