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
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
- 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?
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:
>
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.
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.
- 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
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