2
Hello. I’m trying to get a Node of an xml Nfe can this appearing image error.
At the beginning of the class a variable was created private XDocument xDoc;
The xml file is inside the debug folder.
Even putting so appears the same Error:
XElement _xDetModelo = new XElement(xDoc.Element("nfeProc").Element("NFe").Element("infNFe").Element("det"));
Below part of the XML code I’m trying to get:
<?xml version="1.0" encoding="UTF-8"?>
<nfeProc xmlns="http://www.portalfiscal.inf.br/nfe" versao="3.10">
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
<infNFe Id="NFeXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" versao="3.10">
<ide>
...
</ide>
<emit>
...
</emit>
<dest>
...
</dest>
<det nItem="1">
<prod>
...
Virgilio Novic Thank you, your solution worked. Just a doubt. is it possible to leave the namespace "Universal" to my variable xDoc? so I wouldn’t have to keep putting namespace + "...".
– Luis Medeiros
@Luismedeiros, nothing ... I had also searched before this, maybe it happens because it can have several
namespace
at each node! What can be done a class with functionsstatic
to fix it. but, I don’t know if that would be good...– novic
@Luismedeiros I made an edition and put an anonymous function to assist ...
– novic