/// <summary> /// Parses the group trailer. /// </summary> /// <param name="group"> /// EDI segment. /// </param> protected override void CreateGroupTrailer(XElement group) { try { Result.Add(SegmentParser.ParseXml <S_UNE>(FindSegment(group, EdiSegments.Une), InterchangeContext)); } catch (ParserException) { // skip exception as edifact groups are optional } }
/// <summary> /// Parses an edi message /// </summary> /// <param name="typedMessage"> /// The Xml edi. /// </param> protected void CreateSegments(XElement typedMessage) { // Clear all empty nodes typedMessage.Descendants().Where(d => string.IsNullOrEmpty(d.Value)).Remove(); typedMessage.Descendants().Where(d => string.IsNullOrWhiteSpace(d.Value)).Remove(); var messageContext = new MessageContext(typedMessage, InterchangeContext); // Get all segments, which are not parents of other segments foreach (var segment in typedMessage.Descendants().Where(d => d.Name.LocalName.StartsWith("S_") && !d.Elements().Any(e => e.Name.LocalName.StartsWith("S_")))) { Result.Add(SegmentParser.ParseXml(messageContext.SystemType, segment, InterchangeContext)); } }
/// <summary> /// Parses the interchange trailer. /// </summary> /// <param name="xmlEdi"> /// EDI segment. /// </param> protected override void CreateInterchangeTrailer(XElement xmlEdi) { Result.Add(SegmentParser.ParseXml <S_IEA>(FindSegment(xmlEdi, EdiSegments.Iea), InterchangeContext)); }
/// <summary> /// Parses the interchange header. /// </summary> /// <param name="xmlEdi"> /// EDI segment. /// </param> protected override void CreateInterchangeHeader(XElement xmlEdi) { Result.Add(SegmentParser.ParseXml <S_UNB>(FindSegment(xmlEdi, EdiSegments.Unb), InterchangeContext)); }
/// <summary> /// Parses the group trailer. /// </summary> /// <param name="group"> /// EDI segment. /// </param> protected override void CreateGroupTrailer(XElement group) { Result.Add(SegmentParser.ParseXml <S_GE>(FindSegment(group, EdiSegments.Ge), InterchangeContext)); }