Click or drag to resize

SatAsciify(String) Method

Replace non-ASCII characters in an XML document with XML numeric character references (where permitted).

Namespace: FirmaSAT
Assembly: diFirmaSatNet (in diFirmaSatNet.dll) Version: 10.70.0.38178 (10.70.0.0)
Syntax
public static string Asciify(
	string xmlFile
)

Parameters

xmlFile  String
Name of XML file (or a string containing XML data)

Return Value

String
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.

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