Left on the Web

More namespace gotchas

Earlier on I had a problem with namespaces for getting XML attributes. When I finally got that sorted, I ran into an even weirder problem when fetching elements using xpath. Again, it was just a tiny little detail.

A small SimpleXML gotcha (with namespaces)

I've so far worked only very little with XML with namespaces, especially in terms of parsing it. Therefor, I was quite stumped today on the parsing of a particular snippet of XML which contained an element that had an xlink:href attribute. I just couldn't get that attribute's value out. The solution, as often seems to be the case, is quite simple.
© 2004 - 2008 Stefan Koopmanschap + Powered by Symfony, photos powered by Flickr, links powered by Ma.gnolia, Shanghai smilies by Iconbuffet. Feeds: rss / atom. Left on the Web v4.2.3