#42083 [Opn->Fbk]: Attributes set in wrong namespace, and multiply defined

From: Date: Mon, 10 Nov 2008 11:18:08 +0000
Subject: #42083 [Opn->Fbk]: Attributes set in wrong namespace, and multiply defined
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1473@lists.php.net to get a copy of this message
ID: 42083 Updated by: vrana@php.net Reported By: mail_ben_schmidt at yahoo dot com dot au -Status: Open +Status: Feedback Bug Type: Documentation problem Operating System: Mac OS X PHP Version: 5.2CVS-2007-07-18 New Comment: SimpleXML should be marked as read-only? I thought it can also create documents and this really seems like a bug. Previous Comments: ------------------------------------------------------------------------ [2007-08-22 16:10:47] tularis@php.net So we should change the documentation that modification of a SimpleXML object results in undefined behavior and people should use XMLWriter for such purposes instead I think. Not sure about this, so if anyone could confirm? ------------------------------------------------------------------------ [2007-08-19 20:06:11] jani@php.net Reclassified. ------------------------------------------------------------------------ [2007-08-18 01:36:02] mail_ben_schmidt at yahoo dot com dot au From the SimpleXML functions page in the manual (just prior to one of the later examples): "Data in SimpleXML doesn't have to be constant. The object allows for manipulation of all of its elements." I think setting attributes comfortably fits into 'all of its elements', although 'elements' is probably a poor word to choose in this context. My understanding is that SimpleXML is just meant to be consistent and logical, so that it doesn't need lots of specific documentation. You can manipulate its objects like you would expect to manipulate any other PHP objects: unsetting deletes stuff, assigning changes stuff, or adds stuff, enumerating goes through stuff. And it works for subelements, attributes, whatever. If it's not allowed you get a warning or error, not a silent failure or invalid XML document. That said, the extension is not all that well documented yet, something I have volunteered to help with a bit, and will do when I have some time (I must say, I was a bit scared off by the length of the documentation about the documentation...but I hope to get to it before too long). Ben. ------------------------------------------------------------------------ [2007-08-17 20:04:54] jani@php.net Where is it documented that you're allowed to modify the xml document like this? For me this just looks like abuse. ------------------------------------------------------------------------ [2007-07-24 04:03:11] mail_ben_schmidt at yahoo dot com dot au Also forgot to explicitly mention that the same attribute can also be added twice using array notation, thereby generating invalid XML. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/42083 -- Edit this bug report at http://bugs.php.net/?id=42083&edit=1

« previous php.doc.bugs (#1473) next »