Xml element: prevent any element from being a child of itself.

I do this error often (shame on copy/paste) and it makes php crash with a white page (since it creates an infinite loop).

Trying to catch errors as early as possible is a good thing IMHO. And a pointer check should not degrade performance.