Re: [PHP-DEV] Making SimpleXML more useful

2011-04-26 Thread David Zülke
That patch is not a good idea. Assume you have this situation: Adding a child "baz" to bar and have it default to no namespace prefix would result in this: Now would be in the namespace "urn:lol". Keep in mind that xmlns="" is, as per the XML spec, a perfectly valid way to

Re: [PHP-DEV] Making SimpleXML more useful

2011-04-26 Thread Tom Samplonius
- Original Message - > Looking at this in more detail...I don't think there's a bug here, or > a > patch required. ... > > problem for me, as I have an XML schema that specifies that the > > child > > elements must not namespace qualified. > Is this possible in an XML schema? I don't k

Re: [PHP-DEV] Making SimpleXML more useful

2011-04-26 Thread Ben Schmidt
Looking at this in more detail...I don't think there's a bug here, or a patch required. It is not possible to use SimpleXML to add a child element without a namespace prefix to a parent element that has a namespace element. Instead, the child element inherits the namespace prefix of the parent.

Re: [PHP-DEV] Making SimpleXML more useful

2011-04-26 Thread Ben Schmidt
I would expect the children() method to return just the last two elements of your input XML: http://localhost/a"; xmlns:ns="http://localhost/a";> as the last two elements are the only ones in the 'http://localhost/a' namespace. No, every element in the document is in the same namespace.

Re: [PHP-DEV] Making SimpleXML more useful

2011-04-26 Thread Michael Shadle
Personally I'd love to see an option to make it spit out an array. Just like te second parameter in json_decode() Since array keys can include colons prefix work would also be easier. Then something akin to array2XML() to spit it back out. On Apr 26, 2011, at 7:43 PM, Tom Samplonius wrote: >

Re: [PHP-DEV] Making SimpleXML more useful

2011-04-26 Thread Tom Samplonius
- Original Message - > A similar problem regarding attributes, that got classified as a doc > bug, but I > don't think is one: http://bugs.php.net/42083 > If you're fishing around that area of the code, though, perhaps it is > quite > obvious to you where/how a patch should be made?

Re: [PHP-DEV] Making SimpleXML more useful

2011-04-26 Thread Ben Schmidt
A similar problem regarding attributes, that got classified as a doc bug, but I don't think is one: http://bugs.php.net/42083 If you're fishing around that area of the code, though, perhaps it is quite obvious to you where/how a patch should be made? Ben. On 27/04/11 9:23 AM, Tom Samploniu

[PHP-DEV] Making SimpleXML more useful

2011-04-26 Thread Tom Samplonius
It is not possible to use SimpleXML to add a child element without a namespace prefix to a parent element that has a namespace element. Instead, the child element inherits the namespace prefix of the parent. So this XML fragment: abc is impossible to construct with SimpleXML. The Simp