Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22117 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85889 invoked by uid 1010); 5 Mar 2006 14:20:42 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 85874 invoked from network); 5 Mar 2006 14:20:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Mar 2006 14:20:42 -0000 X-Host-Fingerprint: 216.117.147.250 unknown Linux 2.4/2.6 Received: from ([216.117.147.250:49576] helo=ctindustries.net) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 96/88-22029-9B3FA044 for ; Sun, 05 Mar 2006 09:20:41 -0500 Received: from [127.0.0.1] (dsta-aa203.pivot.net [66.186.171.203]) (authenticated bits=0) by ctindustries.net (8.12.8/8.12.8) with ESMTP id k25D7M3w032562 for ; Sun, 5 Mar 2006 08:07:22 -0500 Message-ID: <440AF5B1.5040607@ctindustries.net> Date: Sun, 05 Mar 2006 09:29:05 -0500 User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 0609-3, 03/03/2006), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: ClamAV 0.88/1315/Sun Mar 5 05:31:57 2006 on ctindustries.net X-Virus-Status: Clean Subject: new simplexml functionality From: rrichards@ctindustries.net (Rob Richards) I would like to propose adding addChild and addAtribute methods to simplexml. I know these have been shot down in the past, but with Marcus' recent changes to simplexml, they now make sense imo. SimpleXMLElement::addChild(string qName, string value [,string ns]) SimpleXMLElement::addAttribute(string qName, string value [,string ns]) http://www.ctindustries.net/patches/sxe.diff.txt Rational: It is not possible to add elements to a tree, but new namespaced elements/attributes cannot (although existing ones can be modified). With these methods, new attributes and elements can be added that will also create namespaces with prefixes in the event the do not exist in the document. This would pretty much eliminate the need to use DOM in most cases for those who dont want it or have it and make behavior more consistent. It doesn't seem right that some things can be added and other things can't. The method names I used are abritrary so I would not be against changing them. Same goes The behavior of addAtribute. Right now it allows an attribute to be added to an attribute list as long as it does not exist and respects the namespacing passed in as parameters rather than the namespace scope of the attribute list. For now I left it loose, but am not against only allowing attributes to be added to elements. To the argument that DOM could just be used to provide the functionality, the same cause could be made for the getName, getNamespaces and getDocNamespaces methods as well and these new functions are much more useful imo. Rob