Esempio n. 1
0
        //param childIndexName may have an integer on the end if >1 sibling with same name (e.g. NTE2)
        private void  parseReps(System.Xml.XmlElement groupElement, Group groupObject, System.String messageName, System.String childName, System.String childIndexName)
        {
            System.Collections.IList reps = getChildElementsByTagName(groupElement, makeGroupElementName(messageName, childName));
            log.debug("# of elements matching " + makeGroupElementName(messageName, childName) + ": " + reps.Count);

            if (groupObject.isRepeating(childIndexName))
            {
                for (int i = 0; i < reps.Count; i++)
                {
                    parseRep((System.Xml.XmlElement)reps[i], groupObject.get_Renamed(childIndexName, i));
                }
            }
            else
            {
                if (reps.Count > 0)
                {
                    parseRep((System.Xml.XmlElement)reps[0], groupObject.get_Renamed(childIndexName, 0));
                }

                if (reps.Count > 1)
                {
                    System.String newIndexName = groupObject.addNonstandardSegment(childName);
                    for (int i = 1; i < reps.Count; i++)
                    {
                        parseRep((System.Xml.XmlElement)reps[i], groupObject.get_Renamed(newIndexName, i - 1));
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary> Returns given group serialized as a pipe-encoded string - this method is called
        /// by encode(Message source, String encoding).
        /// </summary>
        public static System.String encode(Group source, EncodingCharacters encodingChars)
        {
            System.Text.StringBuilder result = new System.Text.StringBuilder();

            System.String[] names = source.Names;
            for (int i = 0; i < names.Length; i++)
            {
                Structure[] reps = source.getAll(names[i]);
                for (int rep = 0; rep < reps.Length; rep++)
                {
                    if (reps[rep] is Group)
                    {
                        result.Append(encode((Group)reps[rep], encodingChars));
                    }
                    else
                    {
                        System.String segString = encode((Segment)reps[rep], encodingChars);
                        if (segString.Length >= 4)
                        {
                            result.Append(segString);
                            result.Append('\r');
                        }
                    }
                }
            }
            return(result.ToString());
        }
Esempio n. 3
0
 /// <summary> Returns given group serialized as a pipe-encoded string - this method is called
 /// by encode(Message source, String encoding).
 /// </summary>
 protected virtual void encode(Group source, EncodingCharacters encodingChars, Table tbl)
 {
     System.String[] names = source.Names;
     for (int i = 0; i < names.Length; i++)
     {
         Structure[] reps = source.getAll(names[i]);
         for (int rep = 0; rep < reps.Length; rep++)
         {
             if (reps[rep] is Group)
             {
                 Group g = (Group)reps[rep];
                 encode(g, encodingChars, tbl);
             }
             else
             {
                 Segment segment = (Segment)reps[rep];
                 encode(segment, encodingChars, tbl);
             }
         }
     }
 }
Esempio n. 4
0
        /// <summary> Returns given group serialized as a pipe-encoded string - this method is called
        /// by encode(Message source, String encoding).
        /// </summary>
        protected virtual void encode(Group source, EncodingCharacters encodingChars, Table tbl)
        {
            System.String[] names = source.Names;
            for (int i = 0; i < names.Length; i++)
            {
                Structure[] reps = source.getAll(names[i]);
                for (int rep = 0; rep < reps.Length; rep++)
                {
                    if (reps[rep] is Group)
                    {
                        Group g = (Group)reps[rep];
                        encode(g, encodingChars, tbl);

                    }
                    else
                    {
                        Segment segment = (Segment)reps[rep];
                        encode(segment, encodingChars, tbl);
                    }
                }
            }
        }
Esempio n. 5
0
        /// <summary> Returns given group serialized as a pipe-encoded string - this method is called
        /// by encode(Message source, String encoding).
        /// </summary>
        public static System.String encode(Group source, EncodingCharacters encodingChars)
        {
            System.Text.StringBuilder result = new System.Text.StringBuilder();

            System.String[] names = source.Names;
            for (int i = 0; i < names.Length; i++)
            {
                Structure[] reps = source.getAll(names[i]);
                for (int rep = 0; rep < reps.Length; rep++)
                {
                    if (reps[rep] is Group)
                    {
                        result.Append(encode((Group) reps[rep], encodingChars));
                    }
                    else
                    {
                        System.String segString = encode((Segment) reps[rep], encodingChars);
                        if (segString.Length >= 4)
                        {
                            result.Append(segString);
                            result.Append('\r');
                        }
                    }
                }
            }
            return result.ToString();
        }
Esempio n. 6
0
        //param childIndexName may have an integer on the end if >1 sibling with same name (e.g. NTE2)
        private void parseReps(System.Xml.XmlElement groupElement, Group groupObject, System.String messageName, System.String childName, System.String childIndexName)
        {
            System.Collections.IList reps = getChildElementsByTagName(groupElement, makeGroupElementName(messageName, childName));
            log.debug("# of elements matching " + makeGroupElementName(messageName, childName) + ": " + reps.Count);

            if (groupObject.isRepeating(childIndexName))
            {
                for (int i = 0; i < reps.Count; i++)
                {
                    parseRep((System.Xml.XmlElement) reps[i], groupObject.get_Renamed(childIndexName, i));
                }
            }
            else
            {
                if (reps.Count > 0)
                {
                    parseRep((System.Xml.XmlElement) reps[0], groupObject.get_Renamed(childIndexName, 0));
                }

                if (reps.Count > 1)
                {
                    System.String newIndexName = groupObject.addNonstandardSegment(childName);
                    for (int i = 1; i < reps.Count; i++)
                    {
                        parseRep((System.Xml.XmlElement) reps[i], groupObject.get_Renamed(newIndexName, i - 1));
                    }
                }
            }
        }