-1
I have the following XML:
<nfeProc xmlns="http://www.portalfiscal.inf.br/nfe" versao="4.00">
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
<infNFe Id="NFe35201127619821000167550010000026321100027970" versao="4.00">
<ide>
...
</ide>
<emit>
...
</emit>
<dest>
...
</dest>
<det nItem="1">
<prod>
<cProd>9-7071/669</cProd>
<cEAN>7892787019411</cEAN>
<xProd>ALTO-FALANTE KIT FACIL-CEST:0105700</xProd>
<NCM>85182990</NCM>
<CEST>0105700</CEST>
<cBenef/>
<CFOP>5405</CFOP>
<uCom>KT</uCom>
<qCom>20.0000</qCom>
<vUnCom>98.82700000</vUnCom>
<vProd>1976.54</vProd>
<cEANTrib>7892787019411</cEANTrib>
<uTrib>UN</uTrib>
<qTrib>80.0000</qTrib>
<vUnTrib>24.70675000</vUnTrib>
<indTot>1</indTot>
</prod>
<imposto>
...
</imposto>
<infAdProd>Base Calc. ST: R$ 837,75-ICMS Ret. ST: R$ 67,28</infAdProd>
</det>
<det nItem="2">
...
</det>
<det nItem="3">
...
</det>
<total>
...
</total>
<transp>
...
</transp>
<cobr>
...
</cobr>
<pag>
...
</pag>
<infAdic>
...
</infAdic>
<infRespTec>
...
</infRespTec>
</infNFe>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
...
</Signature>
</NFe>
<protNFe versao="4.00">
...
</protNFe>
</nfeProc>
I called xml, via php as follows:
<html>
<body>
<?php
header("Content-type: text/html; charset=utf-8");
$xml = simplexml_load_file("C:\Users\Expedição\Downloads\aktion 2632.xml");
print "<pre>";
//print_r($xml);
print "</pre>";
foreach ($xml as $itens){
echo $itens->NFe->nItem->cEAN;
}
?>
</body>
</html>
The problem is that I just want to return me the field cEAN
and I’m not getting it.
OBS: updated with integer XML.
The return:
A is vdd I xml not this full pq is too big I will edit
– user215055
but looking at the example you can see that just directly access $xml->cEAN, this will bring the output you expect, if it does not work post the entire xml and the generated error.
– Onivaldo
unfortunately it did not work more updated with whole xml and error.
– user215055
I changed the answer see if it worked for you
– Onivaldo
It worked really well thank you
– user215055