Validate an XML file against SAT specifications.
Namespace:
FirmaSATAssembly: diFirmaSatNet (in diFirmaSatNet.dll) Version: 10.50.0.29531
Syntax
C# |
---|
public static int ValidateXml( string xmlFile, XmlOption xmlOpt ) |
Visual Basic (Declaration) |
---|
Public Shared Function ValidateXml ( _ xmlFile As String, _ xmlOpt As XmlOption _ ) As Integer |
Parameters
- xmlFile
- Type: System..::.String
Name of input XML file to be processed (or a string containing XML data)
- xmlOpt
- Type: FirmaSAT..::.XmlOption
Option for strict or loose XML restrictions (optional, default=Strict)
Return Value
0 if successful or non-zero error code
Remarks
This just validates the XML structure, not the signature.
Examples

int n = Sat.ValidateXml("cfdv40-ejemplo.xml"); Console.WriteLine("Sat.ValidateXml returns {0}", n); // Sat.ValidateXml returns 0 int n = Sat.ValidateXml("cfdv40-iedu-badcurp.xml"); Console.WriteLine("Sat.ValidateXml returns {0}", n); // Sat.ValidateXml returns -28 Console.WriteLine(General.ErrorLookup(n)); // XML restriction is violated/XML restriccion es violada (XML_FACET_ERROR) Console.WriteLine(General.LastError()); // Bad attribute/atributo mal [iedu:instEducativas/@CURP] (line 30): // 'JUAN01010101GTOHMD0' is too long/es demasiado largo, maximum length/longitud maxima=18

// Input has valid XML form but an invalid facet error against SAT specifications // Using the "Loose" option validates that the XML form is still correct. int n = Sat.ValidateXml("cfdv40-iedu-badcurp.xml", XmlOption.Loose); Console.WriteLine("Sat.ValidateXml(Loose) returns {0}", n); // Sat.ValidateXml(Loose) returns 0