Example #1
0
 /// <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
     }
 }
Example #2
0
        /// <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));
            }
        }
Example #3
0
 /// <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));
 }
Example #4
0
 /// <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));
 }
Example #5
0
 /// <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));
 }