I generate an XML from Nfse, however I need to treat the special characters, eg: ´^~Ç
etc, I will serialize it this way:
StringWriter sw = new StringWriter();
XmlTextWriter tw = new XmlTextWriter(sw);
XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();
XmlSerializer ser = new XmlSerializer(typeof(GerarNfseEnvio));
FileStream arquivo = new FileStream("E:\NFSe-" + "RPS" +
numero.ToString().PadLeft(15, '0') +
".xml", FileMode.CreateNew);
xsn.Add("", "http://www.abrasf.org.br/nfse.xsd");
ser.Serialize(arquivo, gerar, xsn);
arquivo.Close();
Instead of dealing with field by field, you have some way to change when you create XML
, so, do I deal with everything at once?
EDIT
I generate an xml for example with tags, for example
<Discriminacao>Relógio Henry-250\s\nDescrição 62-29\s\n</Discriminacao>
Can not have accents, etc. It should come out this way:
<Discriminacao>Relogio Henry-250\s\nDescricao 62-29\s\n</Discriminacao>
I want to treat the entire xml as there are many fields.
This line is when I serialize xml
:
ser.Serialize(arquivo, gerar, xsn);
I wanted to know if it is possible before serializing or serializing special characters.
EDIT
I pass the fields this way
gerar.Rps.InfDeclaracaoPrestacaoServico.Tomador.Endereco.Endereco =
tomador.EnderecoCobranca.Trim();
But I did not want to put the function in each field, because there are many, I wanted to know if there is any way to do this when generating xml, when serializing or loading it and replacing, something like that.