/// <summary> /// Deserializes xml markup from file into an Catalogo object /// </summary> /// <param name="fileName">string xml file to load and deserialize</param> /// <param name="obj">Output Catalogo object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out Catalogo obj, out System.Exception exception) { exception = null; obj = default(Catalogo); try { obj = LoadFromFile(fileName); return(true); } catch (System.Exception ex) { exception = ex; return(false); } }
/// <summary> /// Deserializes workflow markup into an Catalogo object /// </summary> /// <param name="xml">string workflow markup to deserialize</param> /// <param name="obj">Output Catalogo object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string xml, out Catalogo obj, out System.Exception exception) { exception = null; obj = default(Catalogo); try { obj = Deserialize(xml); return(true); } catch (System.Exception ex) { exception = ex; return(false); } }
private void SaveAccountsXML(string filename) { Catalogo catalogo = new Catalogo(); catalogo.Version = "1.1"; catalogo.Mes = startDate.ToString("MM"); catalogo.Anio = startDate.Year; catalogo.RFC = company.rfc; foreach (KeyValuePair <string, Account> accountPair in Accounts) { catalogo.Ctas.Add(accountPair.Value.satAccount); } XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(catalogo.Serialize()); XmlAttribute xsi_schema_location = xmlDocument.CreateAttribute("xsi", "schemaLocation", "http://www.w3.org/2001/XMLSchema-instance"); xsi_schema_location.Value = @"www.sat.gob.mx/esquemas/ContabilidadE/1_1/CatalogoCuentas http://www.sat.gob.mx/esquemas/ContabilidadE/1_1/CatalogoCuentas/CatalogoCuentas_1_1.xsd"; xmlDocument.LastChild.Attributes.SetNamedItem(xsi_schema_location); xmlDocument.Save(filename); }
public static bool LoadFromFile(string fileName, out Catalogo obj) { System.Exception exception = null; return(LoadFromFile(fileName, out obj, out exception)); }
public static bool Deserialize(string xml, out Catalogo obj) { System.Exception exception = null; return(Deserialize(xml, out obj, out exception)); }