Read XML attribute

Asked

Viewed 1,323 times

2

I am reading an XML file with the command simplexml_load_file() which has the following structure:

<nfeProc xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">
    <NFe></NFe>
</nfeProc>

How do I get the value of the attribute versao?

I tried the following code but it didn’t work

$xmlsimple=simplexml_load_file($_FILES['filexml']['tmp_name']);
echo $xmlsimple->nfeProc['versao'];
  • Related: http://answall.com/questions/66437/transform-xml-containednuma-string-em-json

1 answer

3


Browser other questions tagged

You are not signed in. Login or sign up in order to post.