note 44389 rejected from ref.dom by betz

From: Date: Wed, 04 Aug 2004 21:43:43 +0000
Subject: note 44389 rejected from ref.dom by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-73960@lists.php.net to get a copy of this message
Note Submitter: paul at allofus decimal org ---- I'm getting fed up with having to be so verbose with DOM methods. A lot of the code I write is of the form: $dom = new DOMDocument(); $doc = $dom->createElement('document'); $a = $dom->createElement('title'); $b = $dom->createTextNode('title of the doc'); $a->appendChild($b); $doc->appendChild($a); In ActionScript, since you can 'insert' methods into classes, I have been able to create a method like this DOMNode.appendChildWithText(nodeName, textValue) { // do same as above, but encapsulated } which turns that mess above into a simple call like $doc->appendChildWithText('title', 'some title'); Has anyone got any idea how I might be able to achieve the same sort of thing in PHP[5]?

« previous php.notes (#73960) next »