ATML1671Reader.reader.ATMLReader.GetTPSName C# (CSharp) Method

GetTPSName() private method

private GetTPSName ( ) : string
return string
        private string GetTPSName()
        {
            string tpsiName = null;
            Stream stream = new MemoryStream(_content);
            var doc = new XPathDocument(stream);
            XPathNavigator nav = doc.CreateNavigator();
            nav.MoveToFollowing(XPathNodeType.Element);
            IDictionary<string, string> namespaces = nav.GetNamespacesInScope(XmlNamespaceScope.All);
            XPathExpression query = nav.Compile("/tpsi:CASS_MTPSI/tpsi:CASS_MTPSI_page/tpsi:UUT/tpsi:UUT_ID");
            var mngr = new XmlNamespaceManager(new NameTable());
            foreach (var nskvp in namespaces)
            {
                mngr.AddNamespace(nskvp.Key, nskvp.Value);
                if (nskvp.Key == "")
                    mngr.AddNamespace("tpsi", nskvp.Value);
            }
            //mngr.AddNamespace("bk", "urn:MyNamespace");
            query.SetContext(mngr);
            XPathNodeIterator xPathIt = nav.Select(query);
            if (xPathIt.Count > 0)
            {
                if (xPathIt.MoveNext())
                {
                    XPathNavigator curNav = xPathIt.Current;
                    if (curNav.HasAttributes)
                    {
                        tpsiName = curNav.GetAttribute("TPS_Name", "");
                        LogManager.SourceTrace(SOURCE,"TPS Name: " + tpsiName);
                    }
                }
            }
            return tpsiName;
        }