Convert EDI to XML or Generate XSD

Convert EDI to XML by using .NET XML Serializer. All EDI rules are marked for serialization.

public static  XDocument Serialize(EdiMessage instance)
    if (instance == null)
        throw new ArgumentNullException("instance");

    var serializer = new XmlSerializer(instance.GetType());
    using (var ms = new MemoryStream())
        serializer.Serialize(ms, instance);
        ms.Position = 0;
        return XDocument.Load(ms, LoadOptions.PreserveWhitespace);

Use XSD.exe to generate XSD for an assembly containing EDI rules.

xsd.exe C:\InputEdiRuleFolder\EdiFabric.Rules.X12EdiRule.dll /o:C:\OutputXsdFolder