I want to parse xxm file like the below. but the result does not have any attributes include href for first "a" tag.
<?php
$xmlContent = <<<XML
<ol>
<li>
<a href="Untitled-1-1.xhtml">1</a>
</li>
<li>
<a href="Untitled-1-2.xhtml"/>
</li>
</ol>
XML;
$xml = new \SimpleXMLElement($xmlContent);
print_r($xml);
?>
Result:
[li] => Array
(
[0] => SimpleXMLElement Object
(
[a] => 1
)
[1] => SimpleXMLElement Object
(
[a] => SimpleXMLElement Object
(
[@attributes] => Array
(
[href] => Untitled-1-2.xhtml
)
)
)
)