0

Suppose you have an xml doc with tags with ns colons such as <person:core age="25" />, how do you get the attribute value using PHP DOMDocument?

hakre
  • 193,403
  • 52
  • 435
  • 836
ina
  • 19,167
  • 39
  • 122
  • 201
  • possible duplicate of [Parsing XML attributes within a namespace tag (PHP)](http://stackoverflow.com/questions/6698870/parsing-xml-attributes-within-a-namespace-tag-php) – hakre Jun 21 '13 at 23:07
  • If the XML does not declare that prefix, it will be dropped and the duplicate is: [PHP DOMDocument getting Attribute of Tag](http://stackoverflow.com/questions/1597746/php-domdocument-getting-attribute-of-tag) – hakre Jun 21 '13 at 23:10

1 Answers1

0

You probably want to look into the DOMDocument::getElementsByTagNameNS() [docs] method, which should do what you need. I can't provide you with specific code, since you haven't included the XML file you're working with.

EdoDodo
  • 8,220
  • 3
  • 24
  • 30