public static object LoadXmltoStr(string xml, VersaoNFe versao, string stTipo) { var xs = new XmlSerializer(Factory.GetXMLType(versao, stTipo)); var memoryStream = new MemoryStream(StringToUtf8ByteArray(xml)); return(xs.Deserialize(memoryStream)); }
public static Type GetXMLType(VersaoNFe version, string stType) { Type tipo = null; if (version == VersaoNFe.v200) { tipo = Type.GetType(Schema200ns + stType); } else if (version == VersaoNFe.v300) { tipo = Type.GetType(Schema300ns + stType); } else if (version == VersaoNFe.v310) { tipo = Type.GetType(Schema310ns + stType); } else if (version == VersaoNFe.Integracao) { tipo = Type.GetType("SchemaXML." + stType); } else { throw new Exception("Tipo não pode ser definido."); } return(tipo); }
public static object LoadXmltoStr(string xml, VersaoNFe versao, string stTipo) { var xs = new XmlSerializer(Factory.GetXMLType(versao, stTipo)); var memoryStream = new MemoryStream(StringToUtf8ByteArray(xml)); return xs.Deserialize(memoryStream); }
public static Type GetXMLType(VersaoNFe version, string stType) { Type _type = null; if (version == VersaoNFe.v200) { _type = Type.GetType(Schema200ns + stType); } else if (version == VersaoNFe.v300) { _type = Type.GetType(Schema300ns + stType); } else if (version == VersaoNFe.v310) { _type = Type.GetType(Schema310ns + stType); } else if (version == VersaoNFe.Integracao) { _type = Type.GetType("SchemaXML." + stType); } else { throw new Exception("Tipo não pode ser definido."); } return _type; }