Replace non-ASCII characters in an XML document with XML numeric character references (where permitted).
Namespace:
FirmaSATAssembly: diFirmaSatNet (in diFirmaSatNet.dll) Version: 10.50.0.29531
Syntax
C# |
---|
public static string Asciify( string xmlFile ) |
Visual Basic (Declaration) |
---|
Public Shared Function Asciify ( _ xmlFile As String _ ) As String |
Parameters
- xmlFile
- Type: System..::.String
Name of XML file (or a string containing XML data)
Return Value
XML document as a string with non-ASCII characters replaced by XML numeric character references.
Remarks
In almost all cases, the output contains only US-ASCII characters and can safely be used as input to other functions
without concern for character encoding issues.
For example, the character "ó" (U+00F3 LATIN SMALL LETTER O WITH ACUTE) is replaced by the XML character reference "ó".
In certain cases, some characters in an XML document cannot be replaced by a numeric character reference, for example where they are used in an element or attribute name, such as Año="2016". In these cases, they are left as UTF-8-encoded characters.
Examples

Console.WriteLine(Sat.Asciify("cfdv40-ejemplo.xml"); // <?xml version="1.0" ?> // <cfdi:Comprobante ... > // <cfdi:Emisor Rfc=" AAA010101AAA" Nombre="Esta es una demostración" RegimenFiscal="622"></cfdi:Emisor> // ... [etc]