Skip to content

Instantly share code, notes, and snippets.

@jpetitcolas
Created October 2, 2013 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpetitcolas/6790017 to your computer and use it in GitHub Desktop.
Save jpetitcolas/6790017 to your computer and use it in GitHub Desktop.
Parse XML namespaced elements
$sitemap = new \DOMDocument();
$sitemap->loadXml($feedGenerator->generate());
$xpath = new \DOMXPath($sitemap);
$xpath->registerNamespace('image', 'http://www.google.com/schemas/sitemap-image/1.1');
$image = $xpath->evaluate('//image:image');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment