How can I parse an XML document like this:
<feed>
<item>
<element-name>Element value</element-name>
</item>
</feed>
If I try the following, it doesn't work:
$xmlObject = simplexml_load_string($xmlString);
foreach($xmlObject->item as $item) {
$elementName= $item->element-name; // Obviously doesn't work.
}
I've tried:
$item->element_name;
$item->elementname;
$item->elementName;
None work. How do I access this element's value?