XML Reading Error from NFE Electronic Invoice

Asked

Viewed 161 times

3

People I used windows XSD application to generate classes for NFE, it worked 100%, now I need to use these classes to fill with data of the tax notes that will be imported, I’m doing this:

TNFe nfe = null;
XmlSerializer xmls = new XmlSerializer(typeof(TNFe));
FileStream fs = new FileStream(@"C:\Arquivos\XML_7446_1.xml", FileMode.Open);
nfe = (TNFe)xmls.Deserialize(fs);

Tnfe is the class that is generated by XSD, read here in another topic that use the first tag as classe to complete by this procedure above. If anyone can help me, he makes a mistake like this:

"Error in XML document (1,2)"

the first line of the note is like this:

<?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 versao="3.10" Id="NFe31150608405781000106550010000631581000560951">
  • 1

    I never used, once again a friend was with this problem and it was his XML that was wrong and generated this error.

  • How is your Tnfe? class and xml file?

  • This error is xml line 1 position 2.

  • Put the XML file here

  • I’ve already edited with the data, I’m learning to use here

No answers

Browser other questions tagged

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