當前位置: 首頁>>代碼示例>>C#>>正文


C# XPathNavigator.MoveToRoot方法代碼示例

本文整理匯總了C#中System.Xml.XPath.XPathNavigator.MoveToRoot方法的典型用法代碼示例。如果您正苦於以下問題:C# XPathNavigator.MoveToRoot方法的具體用法?C# XPathNavigator.MoveToRoot怎麽用?C# XPathNavigator.MoveToRoot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.XPath.XPathNavigator的用法示例。


在下文中一共展示了XPathNavigator.MoveToRoot方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnMovingToRootItem

		protected virtual void OnMovingToRootItem(XPathNavigator navigator)
		{
			navigator.MoveToRoot();
			if (!navigator.MoveToFirstChild())
				throw new InvalidXmlException("Expected node n2 not found");
			if (!navigator.MoveToFirstChild())
				throw new InvalidXmlException("Expected node item not found");
		}
開發者ID:grbbod,項目名稱:drconnect-jungo,代碼行數:8,代碼來源:N2XmlReader.cs

示例2: ExtractFromNavigator

 internal static string ExtractFromNavigator(XPathNavigator nav)
 {
     nav.MoveToRoot();
     if (nav.MoveToFirstChild())
     {
         string namespaceURI = nav.NamespaceURI;
         if (!(nav.LocalName != "Envelope") && (!(namespaceURI != "http://schemas.xmlsoap.org/soap/envelope/") || !(namespaceURI != "http://www.w3.org/2003/05/soap-envelope")))
         {
             return namespaceURI;
         }
     }
     return string.Empty;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:13,代碼來源:XPathMessageFunctionSoapUri.cs

示例3: ExtractFromNavigator

 internal static string ExtractFromNavigator(XPathNavigator nav)
 {
     string attribute = nav.GetAttribute(XPathMessageContext.Actor11A, "http://schemas.xmlsoap.org/soap/envelope/");
     string str2 = nav.GetAttribute(XPathMessageContext.Actor12A, "http://www.w3.org/2003/05/soap-envelope");
     nav.MoveToRoot();
     nav.MoveToFirstChild();
     if ((nav.LocalName == "Envelope") && (nav.NamespaceURI == "http://schemas.xmlsoap.org/soap/envelope/"))
     {
         return attribute;
     }
     if ((nav.LocalName == "Envelope") && (nav.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope"))
     {
         return str2;
     }
     return string.Empty;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:16,代碼來源:XPathMessageFunctionActor.cs

示例4: ExtractFromNavigator

 internal static bool ExtractFromNavigator(XPathNavigator nav)
 {
     string str = XPathMessageFunctionActor.ExtractFromNavigator(nav);
     nav.MoveToRoot();
     if (nav.MoveToFirstChild() && (nav.LocalName == "Envelope"))
     {
         if (nav.NamespaceURI == "http://schemas.xmlsoap.org/soap/envelope/")
         {
             return (str == S11UltRec);
         }
         if (nav.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope")
         {
             return (str == S12UltRec);
         }
     }
     return false;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:17,代碼來源:XPathMessageFunctionIsActorUltimateReceiver.cs

示例5: ReadSubtree1

		public void ReadSubtree1 ()
		{
			string xml = "<root/>";

			nav = GetXmlDocumentNavigator (xml);
			ReadSubtree1 (nav, "#1.");

			nav.MoveToRoot ();
			nav.MoveToFirstChild ();
			ReadSubtree1 (nav, "#2.");

			nav = GetXPathDocumentNavigator (document);
			ReadSubtree1 (nav, "#3.");

			nav.MoveToRoot ();
			nav.MoveToFirstChild ();
			ReadSubtree1 (nav, "#4.");
		}
開發者ID:nobled,項目名稱:mono,代碼行數:18,代碼來源:XPathNavigatorReaderTests.cs

示例6: MoveToBody

 internal static bool MoveToBody(XPathNavigator nav)
 {
     nav.MoveToRoot();
     if (nav.MoveToFirstChild())
     {
         string namespaceURI = nav.NamespaceURI;
         if ((nav.LocalName != "Envelope") || ((namespaceURI != "http://schemas.xmlsoap.org/soap/envelope/") && (namespaceURI != "http://www.w3.org/2003/05/soap-envelope")))
         {
             return false;
         }
         if (nav.MoveToFirstChild())
         {
             do
             {
                 if ((nav.LocalName == "Body") && (nav.NamespaceURI == namespaceURI))
                 {
                     return true;
                 }
             }
             while (nav.MoveToNext());
         }
     }
     return false;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:24,代碼來源:XPathMessageFunction.cs

示例7: ExtractFromNavigator

        internal static string ExtractFromNavigator(XPathNavigator nav)
        {
            string actor11 = nav.GetAttribute(XPathMessageContext.Actor11A, XPathMessageContext.S11NS);
            string actor12 = nav.GetAttribute(XPathMessageContext.Actor12A, XPathMessageContext.S12NS);

            nav.MoveToRoot();
            nav.MoveToFirstChild();
            if (nav.LocalName == XPathMessageContext.EnvelopeE && nav.NamespaceURI == XPathMessageContext.S11NS)
            {
                return actor11;
            }
            else if (nav.LocalName == XPathMessageContext.EnvelopeE && nav.NamespaceURI == XPathMessageContext.S12NS)
            {
                return actor12;
            }

            return string.Empty;
        }
開發者ID:krytht,項目名稱:DotNetReferenceSource,代碼行數:18,代碼來源:XPathMessageContext.cs

示例8: setContext

 internal override void setContext( XPathNavigator e) {
     Debug.Assert(e != null);
     e = e.Clone();
     e.MoveToRoot();
     base.setContext( e);
 }
開發者ID:ArildF,項目名稱:masters,代碼行數:6,代碼來源:absolutequery.cs

示例9: XmlSimpleElementContent

		private void XmlSimpleElementContent (XPathNavigator nav)
		{
			AssertNavigator (nav, XPathNodeType.Root, "", "", "", "", "", false, true, false);
			Assert (nav.MoveToFirstChild ());
			AssertNavigator (nav, XPathNodeType.Element, "", "foo", "", "foo", "", false, true, false);
			Assert (!nav.MoveToNext ());
			Assert (!nav.MoveToPrevious ());

			Assert (nav.MoveToFirstChild ());
			AssertNavigator (nav, XPathNodeType.Element, "", "bar", "", "bar", "", false, false, true);

			Assert (nav.MoveToParent ());
			AssertNavigator (nav, XPathNodeType.Element, "", "foo", "", "foo", "", false, true, false);

			nav.MoveToRoot ();
			AssertNavigator (nav, XPathNodeType.Root, "", "", "", "", "", false, true, false);
			Assert (!nav.MoveToNext ());
		}
開發者ID:jjenki11,項目名稱:blaze-chem-rendering,代碼行數:18,代碼來源:XPathNavigatorCommonTests.cs

示例10: NavigateSprts

        IEnumerable<FootballEvent> NavigateSprts(XPathNavigator nav)
        {
            // move to the root and the first element - <books>
            nav.MoveToRoot();

            var sports = nav.Select("//rsp/fd/sports/sport");
            while (sports.MoveNext())
            {
                var sport = sports.Current;
                var sportName = _sportKindResonlver(GetIdFromNode(sport));
                var leagues = sport.Select("leagues/league");

                while (leagues.MoveNext())
                {
                    var leagueName = _leagueNameResolver(GetIdFromNode(leagues.Current));
                    var events = leagues.Current.Select("events/event");
                    while (events.MoveNext())
                    {
                        var @event = events.Current;
                        var eventid = GetIdFromNode(@event);

                        var when = DateTimeOffset.Parse(GetChildNodeValue(@event, "startDateTime").First());
                        var homeTeam = GetChildNodeValue(@event, "homeTeam/name").First();
                        var awayTeam = GetChildNodeValue(@event, "awayTeam/name").First();

                        var periods = @event.Select("periods/period");
                        var pperiods = ParsePeriods(periods).ToArray();

                        yield return new FootballEvent { AwayTeam = awayTeam, HomeTeam = homeTeam, League = leagueName, Sport = sportName, Periods = pperiods, When = when };
                    }
                }
            }
        }
開發者ID:oreshkor,項目名稱:luckybird,代碼行數:33,代碼來源:PinnacleFeedParser.cs

示例11: MoveToBody

        internal static bool MoveToBody(XPathNavigator nav)
        {
            nav.MoveToRoot();
            if (!nav.MoveToFirstChild())
            {
                return false;
            }

            string ns = nav.NamespaceURI;
            if (nav.LocalName != XPathMessageContext.EnvelopeE || (ns != XPathMessageContext.S11NS && ns != XPathMessageContext.S12NS))
            {
                return false;
            }

            if (!nav.MoveToFirstChild())
            {
                return false;
            }

            do
            {
                if (nav.LocalName == XPathMessageContext.BodyE && nav.NamespaceURI == ns)
                {
                    return true;
                }
            } while (nav.MoveToNext());

            return false;
        }
開發者ID:krytht,項目名稱:DotNetReferenceSource,代碼行數:29,代碼來源:XPathMessageContext.cs

示例12: XmlRootElementOnly

		private void XmlRootElementOnly (XPathNavigator nav)
		{
			AssertNavigator ("#1", nav, XPathNodeType.Root, "", "", "", "", "", false, true, false);
			Assert.IsTrue (nav.MoveToFirstChild ());
			AssertNavigator ("#2", nav, XPathNodeType.Element, "", "foo", "", "foo", "", false, false, true);
			Assert.IsTrue (!nav.MoveToFirstChild ());
			Assert.IsTrue (!nav.MoveToNext ());
			Assert.IsTrue (!nav.MoveToPrevious ());
			nav.MoveToRoot ();
			AssertNavigator ("#3", nav, XPathNodeType.Root, "", "", "", "", "", false, true, false);
			Assert.IsTrue (!nav.MoveToNext ());
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:12,代碼來源:XPathNavigatorCommonTests.cs

示例13: DocumentWithXmlDeclaration

		public void DocumentWithXmlDeclaration ()
		{
			document.LoadXml ("<?xml version=\"1.0\" standalone=\"yes\"?><Root><foo>bar</foo></Root>");
			navigator = document.CreateNavigator ();

			navigator.MoveToRoot ();
			navigator.MoveToFirstChild ();
			Assert.AreEqual (XPathNodeType.Element, navigator.NodeType, "#1");
			Assert.AreEqual ("Root", navigator.Name, "#2");
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:10,代碼來源:XPathNavigatorTests.cs

示例14: AttributesAndNamespaces

		[Category ("NotDotNet")] // MS bug
		public void AttributesAndNamespaces ()
		{
			string xml = "<root attr='value' x:a2='v2' xmlns:x='urn:foo' xmlns='urn:default'></root>";

			nav = GetXmlDocumentNavigator (xml);
			AttributesAndNamespaces (nav, "#1.");

			nav.MoveToRoot ();
			nav.MoveToFirstChild ();
			AttributesAndNamespaces (nav, "#2.");

			nav = GetXPathDocumentNavigator (document);
			AttributesAndNamespaces (nav, "#3.");

			nav.MoveToRoot ();
			nav.MoveToFirstChild ();
			AttributesAndNamespaces (nav, "#4.");
		}
開發者ID:nobled,項目名稱:mono,代碼行數:19,代碼來源:XPathNavigatorReaderTests.cs

示例15: DocElem_OpenClose_Attribute

		public void DocElem_OpenClose_Attribute ()
		{
			string xml = "<root attr='value'></root>";

			nav = GetXmlDocumentNavigator (xml);
			DocElem_OpenClose_Attribute (nav, "#1.");

			nav.MoveToRoot ();
			nav.MoveToFirstChild ();
			DocElem_OpenClose_Attribute (nav, "#2.");

			nav = GetXPathDocumentNavigator (document);
			DocElem_OpenClose_Attribute (nav, "#3.");

			nav.MoveToRoot ();
			nav.MoveToFirstChild ();
			DocElem_OpenClose_Attribute (nav, "#4.");
		}
開發者ID:nobled,項目名稱:mono,代碼行數:18,代碼來源:XPathNavigatorReaderTests.cs


注:本文中的System.Xml.XPath.XPathNavigator.MoveToRoot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。