Re: New Package Proposal

From: Date: Wed, 08 Jun 2005 20:36:29 +0000
Subject: Re: New Package Proposal
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-38034@lists.php.net to get a copy of this message
Hi, Aeden Jameson schrieb:
I didn't see much resemblence between this tool and Digester. I didn't see where the package provided for the trigger of some processing when a XML element is encountered. Both can be used to configure objects from XML documents.
I'm not sure what you mean here. Do you believe there is a superflous amount of objects created? If so, why? Maybe I'm just slow, but I'm not sure what you mean here. What I wanted to say that if you are using digester to create some ready configured objects, this may be not the best solution in PHP. While it's common practice to use objects for everything in Java (well there isn't anything else your could use) a typical PHP developer tends to use assoc arrays for the same kind of data.
As the Java Digester provides some ready-to-use rules to create and configure objects, the PHP version should provide rules to create arrays. This is something I probably would not want do in PHP: digester.addObjectCreate( "catalog/book", Book.class ); digester.addBeanPropertySetter( "catalog/book/author", "author" ); digester.addBeanPropertySetter( "catalog/book/title", "title" ); digester.addSetNext( "catalog/book", "addBook" ); And this is something where I prefer patConfiguration, where I can easily define a rule, that book is an array and I want title and author as strings stored in this array: <define tag="book" type="array"/> <define tag="title" type="string"/> <define tag="author" type="string"/> My remarks are only applicable, when Digester is used to map an XML document to several "beans" (or whatever you would call them in PHP). Of course Digester allows you to do some more than this, while I've never used it for anything else. I'd say the best approach would be officially proposing the package through PEPr, so you can show us the code and some examples. I'm quite interested in the PHP port, as I just ported patConfiguration to Java to parse some files where Digester just would have been overkill. Stephan -- http://www.php-tools.net http://www.schst.net http://pear.php.net

« previous php.pear.dev (#38034) next »