Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (36 sloc) 1.51 KB
using EdiFabric.Examples.EDIFACT.Common;
using EdiFabric.Templates.EdifactD96A;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Xml.Linq;
namespace EdiFabric.Examples.EDIFACT.XML
{
class DeserializeFromXml
{
/// <summary>
/// De-serialize to an EDI object from XML using XmlSerializer
/// </summary>
public static void WithXmlSerializer()
{
Debug.WriteLine("******************************");
Debug.WriteLine(MethodBase.GetCurrentMethod().Name);
Debug.WriteLine("******************************");
var ediStream = File.OpenRead(Directory.GetCurrentDirectory() + @"\..\..\..\Files\Edifact\PurchaseOrder.xml");
var xml = XElement.Load(ediStream);
var transaction = xml.Deserialize<TSORDERS>();
}
/// <summary>
/// De-serialize to an EDI object from XML using DataContractSerializer
/// </summary>
public static void WithDataContractSerializer()
{
Debug.WriteLine("******************************");
Debug.WriteLine(MethodBase.GetCurrentMethod().Name);
Debug.WriteLine("******************************");
var ediStream = File.OpenRead(Directory.GetCurrentDirectory() + @"\..\..\..\Files\Edifact\PurchaseOrder2.xml");
var xml = XElement.Load(ediStream);
var transaction = xml.DeserializeDataContract<TSORDERS>();
}
}
}
You can’t perform that action at this time.