예제 #1
0
        public void ParseFile(String filename)
        {
            TextReader tReader = new StreamReader(filename);
            var settings = new XmlReaderSettings
                               {
                                   CheckCharacters = false,
                                   ValidationType = ValidationType.None,
                                   ConformanceLevel = ConformanceLevel.Fragment,
                                   IgnoreProcessingInstructions = true
                               };
            XmlReader reader = XmlReader.Create(tReader, settings);
            var columnArray = new String[10];
            int colCount = -1;
            bool isTag = true;
            bool isUid = true;
            try
            {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        bool isFirst = true;
                        if (reader.Name == "w:tbl")
                        {
                            while (reader.Read())
                            {
                                if (reader.IsStartElement())
                                {
                                    if (reader.Name == "w:tc")
                                    {
                                        colCount++;
                                    }
                                    else if (reader.Name == "w:t")
                                    {
                                        String val = reader.ReadString();
                                        //if (val != "(")
                                        if (columnArray[colCount] == null)
                                            columnArray[colCount] = val;
                                        else
                                            columnArray[colCount] += val;
                                    }
                                }
                                if ((reader.NodeType == XmlNodeType.EndElement)
                                    && (reader.Name == "w:tr"))
                                {
                                    if (isFirst)
                                    {
                                        if (columnArray[0] == "Tag")
                                        {
                                            isTag = true;
                                            isUid = false;
                                        }
                                        else
                                        {
                                            isTag = false;
                                            isUid = true;
                                        }

                                        isFirst = false;
                                    }
                                    else
                                    {
                                        if (isTag)
                                        {
                                            var thisTag = new Tag();
                                            if (columnArray[0] != null && columnArray[0] != "Tag")
                                            {
                                                thisTag.tag = columnArray[0];
                                                thisTag.name = columnArray[1];
                                                thisTag.dicomVarName = columnArray[2];
                                                if (columnArray[3] != null)
                                                    thisTag.vr = columnArray[3].Trim();
                                                if (columnArray[4] != null)
                                                    thisTag.vm = columnArray[4].Trim();
                                                thisTag.retired = columnArray[5];

                                                // Handle repeating groups
                                                if (thisTag.tag[3] == 'x')
                                                    thisTag.tag = thisTag.tag.Replace("xx", "00");

                                                var charSeparators = new[] { '(', ')', ',', ' ' };

                                                String[] nodes = thisTag.tag.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries);
                                                UInt32 group, element; 
                                                if (UInt32.TryParse(nodes[0],NumberStyles.HexNumber,null, out group)
                                                 && UInt32.TryParse(nodes[1], NumberStyles.HexNumber,null, out element)
                                                    && thisTag.name != null)
                                                {
                                                    thisTag.nTag = element | group << 16;

                                                    CreateNames(ref thisTag);

                                                    if (!thisTag.varName.Equals("Item")
                                                     && !thisTag.varName.Equals("ItemDelimitationItem")
                                                     && !thisTag.varName.Equals("SequenceDelimitationItem")
                                                     && !thisTag.varName.Equals("GroupLength"))
                                                        Tags.Add(thisTag.nTag, thisTag);
                                                }
                                            }
                                        }
                                        else if (isUid)
                                        {

                                            if (columnArray[0] != null)
                                            {
                                                var thisUid = new SopClass
                                                                  {
                                                                      Uid = columnArray[0] ?? string.Empty,
                                                                      Name = columnArray[1] ?? string.Empty,
                                                                      Type = columnArray[2] ?? string.Empty
                                                                  };


                                                thisUid.VarName = CreateVariableName(thisUid.Name);

                                                // Take out the invalid chars in the name, and replace with escape characters.
                                                thisUid.Name = SecurityElement.Escape(thisUid.Name);

                                                if (thisUid.Type == "SOP Class")
                                                {
                                                    // Handling leading digits in names
                                                    if (thisUid.VarName.Length > 0 && char.IsDigit(thisUid.VarName[0]))
                                                        thisUid.VarName = "Sop" + thisUid.VarName;
                                                    SopClasses.Add(thisUid.Name, thisUid);
                                                }
                                                else if (thisUid.Type == "Transfer Syntax")
                                                {
                                                    int index = thisUid.VarName.IndexOf(':');
                                                    if (index != -1)
                                                        thisUid.VarName = thisUid.VarName.Remove(index);

                                                    TranferSyntaxes.Add(thisUid.Name, thisUid);
                                                }
                                                else if (thisUid.Type == "Meta SOP Class")
                                                {
                                                    // Handling leading digits in names
                                                    if (thisUid.VarName.Length > 0 && char.IsDigit(thisUid.VarName[0]))
                                                        thisUid.VarName = "Sop" + thisUid.VarName;
                                                    MetaSopClasses.Add(thisUid.Name, thisUid);
                                                }
                                            }
                                        }
                                    }

                                    colCount = -1;
                                    for (int i = 0; i < columnArray.Length; i++)
                                        columnArray[i] = null;
                                }

                                if ((reader.NodeType == XmlNodeType.EndElement)
                                 && (reader.Name == "w:tbl"))
                                    break; // end of table
                            }
                        }
                    }
                }
            }
            catch (XmlException)
            {

            }
            catch (Exception e)
            {
                Console.WriteLine(string.Format("Unexpected exception: {0}", e.Message));
            }
        }
예제 #2
0
        public static void CreateNames(ref Tag thisTag)
        {
            thisTag.varName = CreateVariableName(thisTag.name);

            // Handling leading digits in names
            if (thisTag.varName.Length > 0 && char.IsDigit(thisTag.varName[0]))
                thisTag.varName = thisTag.dicomVarName;

            if (thisTag.retired != null 
             && thisTag.retired.Equals("RET") 
             && !thisTag.varName.EndsWith("Retired"))
                thisTag.varName += "Retired";
        	thisTag.name = thisTag.name.Replace("’", "'");
        	thisTag.unEscapedName = thisTag.name;
            thisTag.name = SecurityElement.Escape(thisTag.name);
        }
예제 #3
0
        private void AddGroupZeroTags(SortedList <uint, Tag> tags)
        {
            Tag thisTag = new Tag();

            thisTag.name    = "Affected SOP Class UID";
            thisTag.tag     = "(0000,0002)";
            thisTag.vr      = "UI";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00000002;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Requested SOP Class UID";
            thisTag.tag     = "(0000,0003)";
            thisTag.vr      = "UI";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00000003;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Command Field";
            thisTag.tag     = "(0000,0100)";
            thisTag.vr      = "US";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00000100;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag.name    = "Message ID";
            thisTag.tag     = "(0000,0110)";
            thisTag.vr      = "US";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00000110;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Message ID Being Responded To";
            thisTag.tag     = "(0000,0120)";
            thisTag.vr      = "US";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00000120;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Move Destination";
            thisTag.tag     = "(0000,0600)";
            thisTag.vr      = "AE";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00000600;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Priority";
            thisTag.tag     = "(0000,0700)";
            thisTag.vr      = "US";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00000700;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Data Set Type";
            thisTag.tag     = "(0000,0800)";
            thisTag.vr      = "US";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00000800;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Status";
            thisTag.tag     = "(0000,0900)";
            thisTag.vr      = "US";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00000900;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Offending Element";
            thisTag.tag     = "(0000,0901)";
            thisTag.vr      = "AT";
            thisTag.vm      = "1-n";
            thisTag.retired = "";
            thisTag.nTag    = 0x00000901;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Error Comment";
            thisTag.tag     = "(0000,0902)";
            thisTag.vr      = "LO";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00000902;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Error ID";
            thisTag.tag     = "(0000,0903)";
            thisTag.vr      = "US";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00000903;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Affected SOP Instance UID";
            thisTag.tag     = "(0000,1000)";
            thisTag.vr      = "UI";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00001000;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Requested SOP Instance UID";
            thisTag.tag     = "(0000,1001)";
            thisTag.vr      = "UI";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00001001;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Event Type ID";
            thisTag.tag     = "(0000,1002)";
            thisTag.vr      = "US";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x000001002;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Attribute Identifier List";
            thisTag.tag     = "(0000,1005)";
            thisTag.vr      = "AT";
            thisTag.vm      = "1-n";
            thisTag.retired = "";
            thisTag.nTag    = 0x000001005;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Action Type ID";
            thisTag.tag     = "(0000,1008)";
            thisTag.vr      = "US";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x000001008;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Number of Remaining Sub-operations";
            thisTag.tag     = "(0000,1020)";
            thisTag.vr      = "US";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00001020;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Number of Completed Sub-operations";
            thisTag.tag     = "(0000,1021)";
            thisTag.vr      = "US";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00001021;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Number of Failed Sub-operations";
            thisTag.tag     = "(0000,1022)";
            thisTag.vr      = "US";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00001022;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Number of Warning Sub-operations";
            thisTag.tag     = "(0000,1023)";
            thisTag.vr      = "US";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00001023;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Move Originator Application Entity Title";
            thisTag.tag     = "(0000,1030)";
            thisTag.vr      = "AE";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00001030;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Move Originator Message ID";
            thisTag.tag     = "(0000,1031)";
            thisTag.vr      = "US";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00001031;
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag         = new Tag();
            thisTag.name    = "Group 2 Length";
            thisTag.tag     = "(0002,0000)";
            thisTag.vr      = "UL";
            thisTag.vm      = "1";
            thisTag.retired = "";
            thisTag.nTag    = 0x00020000;
            Parser.CreateNames(ref thisTag);
            //tags.Add(thisTag.nTag, thisTag);
        }
예제 #4
0
        private void AddGroupZeroTags(SortedList<uint, Tag> tags)
        {
            var thisTag = new Tag
                              {
                                  name = "Affected SOP Class UID",
                                  tag = "(0000,0002)",
                                  vr = "UI",
                                  vm = "1",
                                  retired = "",
                                  nTag = 0x00000002
                              };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Requested SOP Class UID",
                              tag = "(0000,0003)",
                              vr = "UI",
                              vm = "1",
                              retired = "",
                              nTag = 0x00000003
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Command Field",
                              tag = "(0000,0100)",
                              vr = "US",
                              vm = "1",
                              retired = "",
                              nTag = 0x00000100
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Message ID",
                              tag = "(0000,0110)",
                              vr = "US",
                              vm = "1",
                              retired = "",
                              nTag = 0x00000110
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Message ID Being Responded To",
                              tag = "(0000,0120)",
                              vr = "US",
                              vm = "1",
                              retired = "",
                              nTag = 0x00000120
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Move Destination",
                              tag = "(0000,0600)",
                              vr = "AE",
                              vm = "1",
                              retired = "",
                              nTag = 0x00000600
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Priority",
                              tag = "(0000,0700)",
                              vr = "US",
                              vm = "1",
                              retired = "",
                              nTag = 0x00000700
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Data Set Type",
                              tag = "(0000,0800)",
                              vr = "US",
                              vm = "1",
                              retired = "",
                              nTag = 0x00000800
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Status",
                              tag = "(0000,0900)",
                              vr = "US",
                              vm = "1",
                              retired = "",
                              nTag = 0x00000900
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Offending Element",
                              tag = "(0000,0901)",
                              vr = "AT",
                              vm = "1-n",
                              retired = "",
                              nTag = 0x00000901
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Error Comment",
                              tag = "(0000,0902)",
                              vr = "LO",
                              vm = "1",
                              retired = "",
                              nTag = 0x00000902
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Error ID",
                              tag = "(0000,0903)",
                              vr = "US",
                              vm = "1",
                              retired = "",
                              nTag = 0x00000903
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Affected SOP Instance UID",
                              tag = "(0000,1000)",
                              vr = "UI",
                              vm = "1",
                              retired = "",
                              nTag = 0x00001000
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Requested SOP Instance UID",
                              tag = "(0000,1001)",
                              vr = "UI",
                              vm = "1",
                              retired = "",
                              nTag = 0x00001001
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Event Type ID",
                              tag = "(0000,1002)",
                              vr = "US",
                              vm = "1",
                              retired = "",
                              nTag = 0x000001002
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Attribute Identifier List",
                              tag = "(0000,1005)",
                              vr = "AT",
                              vm = "1-n",
                              retired = "",
                              nTag = 0x000001005
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Action Type ID",
                              tag = "(0000,1008)",
                              vr = "US",
                              vm = "1",
                              retired = "",
                              nTag = 0x000001008
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Number of Remaining Sub-operations",
                              tag = "(0000,1020)",
                              vr = "US",
                              vm = "1",
                              retired = "",
                              nTag = 0x00001020
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Number of Completed Sub-operations",
                              tag = "(0000,1021)",
                              vr = "US",
                              vm = "1",
                              retired = "",
                              nTag = 0x00001021
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Number of Failed Sub-operations",
                              tag = "(0000,1022)",
                              vr = "US",
                              vm = "1",
                              retired = "",
                              nTag = 0x00001022
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Number of Warning Sub-operations",
                              tag = "(0000,1023)",
                              vr = "US",
                              vm = "1",
                              retired = "",
                              nTag = 0x00001023
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Move Originator Application Entity Title",
                              tag = "(0000,1030)",
                              vr = "AE",
                              vm = "1",
                              retired = "",
                              nTag = 0x00001030
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Move Originator Message ID",
                              tag = "(0000,1031)",
                              vr = "US",
                              vm = "1",
                              retired = "",
                              nTag = 0x00001031
                          };
            Parser.CreateNames(ref thisTag);
            tags.Add(thisTag.nTag, thisTag);

            thisTag = new Tag
                          {
                              name = "Group 2 Length",
                              tag = "(0002,0000)",
                              vr = "UL",
                              vm = "1",
                              retired = "",
                              nTag = 0x00020000
                          };
            Parser.CreateNames(ref thisTag);
            //tags.Add(thisTag.nTag, thisTag);
            
        }
예제 #5
0
        public void ParseFile(String filename)
        {
            TextReader tReader  = new StreamReader(filename);
            var        settings = new XmlReaderSettings
            {
                CheckCharacters              = false,
                ValidationType               = ValidationType.None,
                ConformanceLevel             = ConformanceLevel.Fragment,
                IgnoreProcessingInstructions = true
            };
            XmlReader reader      = XmlReader.Create(tReader, settings);
            var       columnArray = new String[10];
            int       colCount    = -1;
            bool      isTag       = true;
            bool      isUid       = true;

            try
            {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        bool isFirst = true;
                        if (reader.Name == "w:tbl")
                        {
                            while (reader.Read())
                            {
                                if (reader.IsStartElement())
                                {
                                    if (reader.Name == "w:tc")
                                    {
                                        colCount++;
                                    }
                                    else if (reader.Name == "w:t")
                                    {
                                        String val = reader.ReadString();
                                        //if (val != "(")
                                        if (columnArray[colCount] == null)
                                        {
                                            columnArray[colCount] = val;
                                        }
                                        else
                                        {
                                            columnArray[colCount] += val;
                                        }
                                    }
                                }
                                if ((reader.NodeType == XmlNodeType.EndElement) &&
                                    (reader.Name == "w:tr"))
                                {
                                    if (isFirst)
                                    {
                                        if (columnArray[0] == "Tag")
                                        {
                                            isTag = true;
                                            isUid = false;
                                        }
                                        else
                                        {
                                            isTag = false;
                                            isUid = true;
                                        }

                                        isFirst = false;
                                    }
                                    else
                                    {
                                        if (isTag)
                                        {
                                            var thisTag = new Tag();
                                            if (columnArray[0] != null && columnArray[0] != "Tag")
                                            {
                                                thisTag.tag          = columnArray[0];
                                                thisTag.name         = columnArray[1];
                                                thisTag.dicomVarName = columnArray[2];
                                                if (columnArray[3] != null)
                                                {
                                                    thisTag.vr = columnArray[3].Trim();
                                                }
                                                if (columnArray[4] != null)
                                                {
                                                    thisTag.vm = columnArray[4].Trim();
                                                }
                                                thisTag.retired = columnArray[5];

                                                // Handle repeating groups
                                                if (thisTag.tag[3] == 'x')
                                                {
                                                    thisTag.tag = thisTag.tag.Replace("xx", "00");
                                                }

                                                var charSeparators = new[] { '(', ')', ',', ' ' };

                                                String[] nodes = thisTag.tag.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries);
                                                UInt32   group, element;
                                                if (UInt32.TryParse(nodes[0], NumberStyles.HexNumber, null, out group) &&
                                                    UInt32.TryParse(nodes[1], NumberStyles.HexNumber, null, out element) &&
                                                    thisTag.name != null)
                                                {
                                                    thisTag.nTag = element | group << 16;

                                                    CreateNames(ref thisTag);

                                                    if (!thisTag.varName.Equals("Item") &&
                                                        !thisTag.varName.Equals("ItemDelimitationItem") &&
                                                        !thisTag.varName.Equals("SequenceDelimitationItem") &&
                                                        !thisTag.varName.Equals("GroupLength"))
                                                    {
                                                        Tags.Add(thisTag.nTag, thisTag);
                                                    }
                                                }
                                            }
                                        }
                                        else if (isUid)
                                        {
                                            if (columnArray[0] != null)
                                            {
                                                var thisUid = new SopClass
                                                {
                                                    Uid  = columnArray[0] ?? string.Empty,
                                                    Name = columnArray[1] ?? string.Empty,
                                                    Type = columnArray[2] ?? string.Empty
                                                };


                                                thisUid.VarName = CreateVariableName(thisUid.Name);

                                                // Take out the invalid chars in the name, and replace with escape characters.
                                                thisUid.Name = SecurityElement.Escape(thisUid.Name);

                                                if (thisUid.Type == "SOP Class")
                                                {
                                                    // Handling leading digits in names
                                                    if (thisUid.VarName.Length > 0 && char.IsDigit(thisUid.VarName[0]))
                                                    {
                                                        thisUid.VarName = "Sop" + thisUid.VarName;
                                                    }
                                                    SopClasses.Add(thisUid.Name, thisUid);
                                                }
                                                else if (thisUid.Type == "Transfer Syntax")
                                                {
                                                    int index = thisUid.VarName.IndexOf(':');
                                                    if (index != -1)
                                                    {
                                                        thisUid.VarName = thisUid.VarName.Remove(index);
                                                    }

                                                    TranferSyntaxes.Add(thisUid.Name, thisUid);
                                                }
                                                else if (thisUid.Type == "Meta SOP Class")
                                                {
                                                    // Handling leading digits in names
                                                    if (thisUid.VarName.Length > 0 && char.IsDigit(thisUid.VarName[0]))
                                                    {
                                                        thisUid.VarName = "Sop" + thisUid.VarName;
                                                    }
                                                    MetaSopClasses.Add(thisUid.Name, thisUid);
                                                }
                                            }
                                        }
                                    }

                                    colCount = -1;
                                    for (int i = 0; i < columnArray.Length; i++)
                                    {
                                        columnArray[i] = null;
                                    }
                                }

                                if ((reader.NodeType == XmlNodeType.EndElement) &&
                                    (reader.Name == "w:tbl"))
                                {
                                    break; // end of table
                                }
                            }
                        }
                    }
                }
            }
            catch (XmlException)
            {
            }
            catch (Exception e)
            {
                Console.WriteLine(string.Format("Unexpected exception: {0}", e.Message));
            }
        }