Skip to content

Commit af24043

Browse files
committed
refactor: remover função ObterXmlComNamespace e utilizar atributos XmlRoot e XmlType
1 parent 24f5610 commit af24043

3 files changed

Lines changed: 2 additions & 12 deletions

File tree

DFe.Utils/FuncoesXml.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,16 +236,6 @@ public static string ObterNodeDeStringXml(string nomeDoNode, string stringXml)
236236
return xmlString.ToString();
237237
}
238238

239-
public static string ObterXmlComNamespace(string xml, string valorNamespace)
240-
{
241-
var documentoXml = new XmlDocument();
242-
documentoXml.LoadXml(xml);
243-
const string nomeAtributoNamespace = "xmlns";
244-
documentoXml.DocumentElement?.SetAttribute(nomeAtributoNamespace, valorNamespace);
245-
var stringXml = documentoXml.InnerXml;
246-
return stringXml;
247-
}
248-
249239
// https://github.com/ZeusAutomacao/DFe.NET/issues/610
250240
private static XmlSerializer BuscarNoCache(string chave, Type type)
251241
{

NFe.Classes/Servicos/Evento/detEvento.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848

4949
namespace NFe.Classes.Servicos.Evento
5050
{
51+
[XmlRoot(Namespace = "http://www.portalfiscal.inf.br/nfe")]
52+
[XmlType(Namespace = "http://www.portalfiscal.inf.br/nfe")]
5153
public class detEvento
5254
{
5355
/// <summary>

NFe.Servicos/ServicosNFe.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,6 @@ private RetornoRecepcaoEvento RecepcaoEvento(int idlote, List<evento> eventos, S
502502
if (_cFgServico.RemoverAcentos)
503503
detEventoXml = detEventoXml.RemoverAcentos();
504504

505-
const string namespaceNfe = "http://www.portalfiscal.inf.br/nfe";
506-
detEventoXml = FuncoesXml.ObterXmlComNamespace(detEventoXml, namespaceNfe);
507505
Validador.Valida(servicoEvento, _cFgServico.VersaoRecepcaoEventoCceCancelamento, detEventoXml, cfgServico: _cFgServico, validarLote: false);
508506
}
509507
}

0 commit comments

Comments
 (0)