当前位置: 首页>>代码示例>>C#>>正文


C# XPathNavigator.MoveToChild方法代码示例

本文整理汇总了C#中System.Xml.XPath.XPathNavigator.MoveToChild方法的典型用法代码示例。如果您正苦于以下问题:C# XPathNavigator.MoveToChild方法的具体用法?C# XPathNavigator.MoveToChild怎么用?C# XPathNavigator.MoveToChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XPath.XPathNavigator的用法示例。


在下文中一共展示了XPathNavigator.MoveToChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessItemGroupNode

        private static bool ProcessItemGroupNode(XPathNavigator nav)
        {
            try
            {
                if (nav.MoveToChild("StyleCopTreatErrorsAsWarnings", "http://schemas.microsoft.com/developer/msbuild/2003"))
                {
                    if (nav.Value == "false")
                    {
                        nav.ReplaceSelf("<StyleCopTreatErrorsAsWarnings>true</StyleCopTreatErrorsAsWarnings>");
                    }
                    else
                    {
                        nav.ReplaceSelf("<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>");
                    }
                }
                else
                {
                    nav.AppendChild("<StyleCopTreatErrorsAsWarnings>true</StyleCopTreatErrorsAsWarnings>");
                }

                return true;
            }
            catch
            {
                return false;
            }
        }
开发者ID:julplee,项目名称:StyleCopToggleWarningsAsErrors,代码行数:27,代码来源:Program.cs

示例2: GetAssemblyIdentityNav

 XPathNavigator GetAssemblyIdentityNav(XPathNavigator nav)
 {
     do
     {
         if (Utilities.Compare(nav.LocalName, "assemblyIdentity"))
             return nav;
     } while (nav.MoveToChild(XPathNodeType.Element));
     return null;
 }
开发者ID:eleooo,项目名称:App,代码行数:9,代码来源:EleoooClient.aspx.cs

示例3: GetChildNodesValue

 private string GetChildNodesValue(XPathNavigator nav, string nodeName)
 {
     string value = string.Empty;
     if (nav.MoveToChild(nodeName, ""))
     {
         value = nav.Value;
         nav.MoveToParent();
     }
     return value;
 }
开发者ID:purplecow,项目名称:Media-Browser,代码行数:10,代码来源:FilmTrailerFolder.cs

示例4: ReadXml

      public void ReadXml(XPathNavigator node, XmlResolver resolver) {

         if (node.NodeType == XPathNodeType.Element) {

            if (node.MoveToFirstAttribute()) {
               do {
                  switch (node.LocalName) {
                     case "media-type":
                        this.MediaType = node.Value;
                        break;

                     case "boundary":
                        this.Boundary = node.Value;
                        break;
                  }
               } while (node.MoveToNextAttribute());

               node.MoveToParent();
            }

            if (node.MoveToChild(XPathNodeType.Element)) {

               XPathHttpMultipartItem currentItem = null;

               do {
                  if (node.NamespaceURI == XPathHttpClient.Namespace) {

                     switch (node.LocalName) {
                        case "header":
                           if (currentItem == null)
                              currentItem = new XPathHttpMultipartItem();

                           currentItem.Headers.Add(node.GetAttribute("name", ""), node.GetAttribute("value", ""));
                           break;

                        case "body":
                           if (currentItem == null)
                              currentItem = new XPathHttpMultipartItem();

                           currentItem.Body = new XPathHttpBody();
                           currentItem.Body.ReadXml(node, resolver);

                           this.Items.Add(currentItem);
                           currentItem = null;
                           break;
                     }
                  }

               } while (node.MoveToNext(XPathNodeType.Element));
               
               node.MoveToParent();
            }
         }
      }
开发者ID:nuxleus,项目名称:Nuxleus,代码行数:54,代码来源:XPathHttpMultipart.cs

示例5: CopyToUnsetValues

        private bool CopyToUnsetValues(XPathNavigator sourceNavigator, RunSettings targetRunSettings)
        {
            if (sourceNavigator.MoveToChild(GoogleTestConstants.SettingsName, ""))
            {
                RunSettings sourceRunSettings = RunSettings.LoadFromXml(sourceNavigator.ReadSubtree());
                targetRunSettings.GetUnsetValuesFrom(sourceRunSettings);

                return true;
            }

            return false;
        }
开发者ID:csoltenborn,项目名称:GoogleTestAdapter,代码行数:12,代码来源:RunSettingsService.cs

示例6: Execute

 public void Execute(XmlDocument doc)
 {
     _navigator = doc.CreateNavigator();
     _navigator.MoveToChild(XPathNodeType.Element);
     ExecuteElement(CurrentElement);
 }
开发者ID:Oaz,项目名称:XmlDocumentProcessor,代码行数:6,代码来源:XmlDocumentProcessor.cs

示例7: MoveToContent

 /// <summary>
 /// Reposition the navigator on the first element child with a matching name.
 /// </summary>
 public override bool MoveToContent(XPathNavigator navigator) {
     return navigator.MoveToChild(this.localName, this.namespaceUri);
 }
开发者ID:uQr,项目名称:referencesource,代码行数:6,代码来源:XmlNavigatorFilter.cs

示例8: ReadXml

        public void ReadXml(XPathNavigator node)
        {
            bool movedToDocEl = false;

             if (node.NodeType == XPathNodeType.Root) {
            movedToDocEl = node.MoveToChild(XPathNodeType.Element);
             }

             if (node.NamespaceURI == XPathHttpClient.Namespace
            && node.LocalName == "request") {

            if (node.NodeType == XPathNodeType.Element) {

               if (node.MoveToFirstAttribute()) {

                  do {
                     switch (node.LocalName) {
                        case "method":
                           this.Method = node.Value;
                           break;

                        case "href":
                           this.Href = new Uri(node.Value, UriKind.Absolute);
                           break;

                        case "status-only":
                           this.StatusOnly = node.ValueAsBoolean;
                           break;

                        case "username":
                           this.Username = node.Value;
                           break;

                        case "password":
                           this.Password = node.Value;
                           break;

                        case "auth-method":
                           this.AuthMethod = node.Value;
                           break;

                        case "send-authorization":
                           this.SendAuthorization = node.ValueAsBoolean;
                           break;

                        case "override-media-type":
                           this.OverrideMediaType = node.Value;
                           break;

                        case "follow-redirect":
                           this.FollowRedirect = node.ValueAsBoolean;
                           break;

                        case "timeout":
                           this.Timeout = node.ValueAsInt;
                           break;

                        default:
                           break;
                     }

                  } while (node.MoveToNextAttribute());

                  node.MoveToParent();
               }

               if (node.MoveToChild(XPathNodeType.Element)) {
                  do {
                     if (node.NamespaceURI == XPathHttpClient.Namespace) {
                        switch (node.LocalName) {
                           case "header":
                              this.Headers.Add(node.GetAttribute("name", ""), node.GetAttribute("value", ""));
                              break;

                           case "body":
                              this.Body = new XPathHttpBody();
                              this.Body.ReadXml(node, this.Resolver);
                              break;

                           case "multipart":
                              this.Multipart = new XPathHttpMultipart();
                              this.Multipart.ReadXml(node, this.Resolver);
                              break;

                           default:
                              break;
                        }
                     }
                  } while (node.MoveToNext(XPathNodeType.Element));

                  node.MoveToParent();
               }
            }
             }

             if (movedToDocEl) {
            node.MoveToParent();
             }
        }
开发者ID:skurdiukov,项目名称:myxsl,代码行数:99,代码来源:XPathHttpRequest.cs

示例9: ReadXml

      public void ReadXml(XPathNavigator node) {

         bool movedToDocEl = false;

         if (node.NodeType == XPathNodeType.Root)
            movedToDocEl = node.MoveToChild(XPathNodeType.Element);

         if (node.NamespaceURI == XPathSmtpClient.Namespace
            && node.LocalName == "message") {

            if (node.MoveToFirstAttribute()) {

               do {
                  if (String.IsNullOrEmpty(node.NamespaceURI)) {

                  }
               } while (node.MoveToNextAttribute());

               node.MoveToParent();
            }

            if (node.MoveToChild(XPathNodeType.Element)) {

               do {
                  if (node.NamespaceURI == XPathSmtpClient.Namespace) {

                     switch (node.LocalName) {
                        case "from":
                           this.From = new XPathMailAddress();
                           this.From.ReadXml(node);
                           break;

                        case "reply-to": {
                              XPathMailAddress address = new XPathMailAddress();
                              address.ReadXml(node);

                              this.ReplyTo.Add(address);
                           }
                           break;

                        case "sender":
                           this.Sender = new XPathMailAddress();
                           this.Sender.ReadXml(node);
                           break;

                        case "to": {
                              XPathMailAddress address = new XPathMailAddress();
                              address.ReadXml(node);

                              this.To.Add(address);
                           }
                           break;

                        case "cc": {
                              XPathMailAddress address = new XPathMailAddress();
                              address.ReadXml(node);

                              this.CC.Add(address);
                           }
                           break;

                        case "bcc": {
                              XPathMailAddress address = new XPathMailAddress();
                              address.ReadXml(node);

                              this.Bcc.Add(address);
                           }
                           break;

                        case "subject":
                           this.Subject = node.Value;
                           break;

                        case "body":
                           this.Body = new XPathMailBody();
                           this.Body.ReadXml(node);
                           break;

                        default:
                           break;
                     }
                  }

               } while (node.MoveToNext(XPathNodeType.Element));

               node.MoveToParent();
            }
         }

         if (movedToDocEl)
            node.MoveToParent();
      }
开发者ID:nuxleus,项目名称:Nuxleus,代码行数:92,代码来源:XPathMailMessage.cs

示例10: FindNodes

        private IEnumerable<XPathNavigator> FindNodes(
            XPathNavigator doc,
            string name)
        {
            List<XPathNavigator> nodes = new List<XPathNavigator>();

            if (doc.Name == name) {
                nodes.Add(doc.Clone());
            }

            if (doc.HasChildren) {
                doc.MoveToChild(XPathNodeType.All);
                do {
                    XPathNavigator child = doc.Clone();
                    nodes.AddRange(this.FindNodes(child, name));
                } while (doc.MoveToNext());
            }

            return nodes;
        }
开发者ID:rogue-bit,项目名称:Triton-Framework,代码行数:20,代码来源:GraphmlSmStateDao.cs

示例11: XReader

 public XReader(string s) {
     navigator = new XPathDocument(new StringReader(s)).CreateNavigator();
     navigator.MoveToChild(XPathNodeType.Element);
     stack.Push(GetNodeName());
 }
开发者ID:srushti,项目名称:xstream.net,代码行数:5,代码来源:XStreamReader.cs

示例12: EventMultiTracerControl


//.........这里部分代码省略.........
                    (
                    new XsltTextTransformer
                        (
                        AppDomain.CurrentDomain.SetupInformation.ApplicationBase +
                        @"XsltEventTransform.xslt"
                        ));
                //
                // logTransform1TabPage
                //
                logTransform1TabPage.Location = new Point(4, 22);
                logTransform1TabPage.Name = "logTransform1TabPage";
                logTransform1TabPage.Size =
                    new Size
                        (
                        logEntryViewsTabControl.Width,
                        logEntryViewsTabControl.Height - 22
                        );
                logTransform1TabPage.TabIndex = 0;
                logTransform1TabPage.Text = "Xml";
                //
                // logTransform2TabPage
                //
                logTransform2TabPage.Location = new Point(4, 22);
                logTransform2TabPage.Name = "logTransform2TabPage";
                logTransform2TabPage.Size =
                    new Size
                        (
                        logEntryViewsTabControl.Width,
                        logEntryViewsTabControl.Height - 22
                        );
                logTransform2TabPage.TabIndex = 1;
                logTransform2TabPage.Text = "Message";
                //
                logEntryViewsTabControl.Controls.Add(logTransform1TabPage);
                logEntryViewsTabControl.Controls.Add(logTransform2TabPage);
                //
                //
                Resize += LogControl_Resize;

                #region  xpath quering proof of concept

                XmlElement xRoot = xEventsCache.CreateElement(null, "ArrayOfApplicationEvent", null);
                xEventsCache.AppendChild(xRoot);

                if (xPathStatementControl.ContextMenuStrip == null)
                {
                    xPathStatementControl.ContextMenuStrip =
                        new ContextMenuStrip();
                }
                xPathStatementControl.ContextMenuStrip.Items.AddRange
                    (
                    new ToolStripMenuItem[2]
                        {
                            applyFilterToolStripMenuItem,
                            cancelFilterToolStripMenuItem
                        });
                applyFilterToolStripMenuItem.Click += applyMenuItem_Click;
                cancelFilterToolStripMenuItem.Click += cancelFilterMenuItem_Click;

                XmlElement xFilterRoot = xEventsFilteredCache.CreateElement
                    (
                    null,
                    "ArrayOfApplicationEvent",
                    null
                    );
                xEventsFilteredCache.AppendChild(xFilterRoot);

                //xPathStatementControl.applyMenuItem.Click +=new EventHandler(applyMenuItem_Click);
                //xPathStatementControl.cancelFilterMenuItem.Click +=new EventHandler(cancelFilterMenuItem_Click);

                #endregion  xpath quering proof of concept

                #region Subscribing to the list view scroll event

                monitorPanel.Scroll += listView1_Scrolled;

                #endregion Subscribing to the list view scroll event

                keysControl = new ContextHolderPointersControl();
                keysControl.Dock = DockStyle.Fill;

                xQueryTabPage.Controls.Add(keysControl);

                monitorPanel.ContextMenu = monitorContolContextMenu;
                monitorPanel.ItemsListView.SelectedIndexChanged += listView1_SelectedIndexChanged;
                monitorPanel.ItemsListView.SetScrollBarMaxValue(1);
                countToShow = 20; //listView1.DisplayRectangle.Height / Convert.ToUInt16(listView1.Font.GetHeight());
                filterBySameFieldToolStripComboBox.ComboBox.DataSource = TraceRecord.CorrelationFieldNames;

                searchBackgroundWorker.DoWork += searchBackgroundWorker_DoFilterBySameFieldWork;
                searchBackgroundWorker.RunWorkerCompleted += searchBackgroundWorker_RunWorkerCompleted;

                navigator = xEventsCache.CreateNavigator();
                navigator.MoveToChild(XPathNodeType.Element);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
开发者ID:alienwaredream,项目名称:toolsdotnet,代码行数:101,代码来源:EventMultiTracerControl.cs

示例13: MoveOffRoot

		private static bool MoveOffRoot(XPathNavigator source, XPathNodeType to)
		{
			if (source.NodeType == XPathNodeType.Root)
			{
				return source.MoveToChild(to);
			}
			return true;
		}
开发者ID:Jarvin-Guan,项目名称:CleanAOP,代码行数:8,代码来源:XPathAdapter.cs

示例14: loadDataFromNavigatorToTitle

        private void loadDataFromNavigatorToTitle(ref XPathNavigator navigator, ref OMLSDKTitle newTitle)
        {
            SDKUtilities.DebugLine("[MyMoviesImporter] Loading data for a new title");
            newTitle.MetadataSourceID = GetChildNodesValue(navigator, "WebServiceID");

            #region covers
            SDKUtilities.DebugLine("[MyMoviesImporter] Scanning for {0} node", "Covers");
            if (navigator.MoveToChild("Covers", ""))
            {
                SDKUtilities.DebugLine("[MyMoviesImporter] Covers found, processing");
                SDKUtilities.DebugLine("[MyMoviesImporter] Scanning for {0} node", "Front");
                if (navigator.MoveToChild("Front", ""))
                {
                    string imagePath = navigator.Value;
                    string finalImagePath = FindFinalImagePath(imagePath);
                    SDKUtilities.DebugLine("[MyMoviesImporter] Final image path is: {0}", finalImagePath);
                    if (File.Exists(finalImagePath))
                    {
                        SDKUtilities.DebugLine("[MyMoviesImporter] This file appears to be valid, we'll set it on the title");
                        newTitle.FrontCoverPath = finalImagePath;
                    }
                    navigator.MoveToParent();
                }
                SDKUtilities.DebugLine("[MyMoviesImporter] Scanning for {0} node", "Back");
                if (navigator.MoveToChild("Back", ""))
                {
                    string imagePath = navigator.Value;
                    if (File.Exists(imagePath))
                    {
                        SDKUtilities.DebugLine("[MyMoviesImporter] Found Back cover image");
                        newTitle.BackCoverPath = imagePath;
                    }
                    navigator.MoveToParent();
                }

                navigator.MoveToParent();
            }
            #endregion

            newTitle.Synopsis = GetChildNodesValue(navigator, "Description");

            #region production year
            if (navigator.MoveToChild("ProductionYear", ""))
            {
                SDKUtilities.DebugLine("[MyMoviesImporter] Found production year, I hope the format is something we can read");
                try
                {
                    string year = navigator.Value;
                    if (!string.IsNullOrEmpty(year))
                    {
                        DateTime rls_date = new DateTime(int.Parse(year), 1, 1);
                        if (rls_date != null)
                        {
                            SDKUtilities.DebugLine("[MyMoviesImporter] Got it, loading the production year");
                            newTitle.ReleaseDate = rls_date;
                        }
                    }
                    navigator.MoveToParent();
                }
                catch (Exception e)
                {
                    navigator.MoveToParent();
                    SDKUtilities.DebugLine("[MyMoviesImporter] error reading ProductionYear: " + e.Message);
                }
            }
            #endregion

            #region parental rating (mpaa rating)
            if (navigator.MoveToChild("ParentalRating", ""))
            {
                SDKUtilities.DebugLine("[MyMoviesImporter] Scanning for the ParentalRating");
                if (navigator.HasChildren)
                {
                    string ratingId = GetChildNodesValue(navigator, "Value");
                    if (!string.IsNullOrEmpty(ratingId))
                    {
                        int mmRatingId;
                        if (int.TryParse(ratingId, out mmRatingId))
                            switch (mmRatingId)
                            {
                                case 0:
                                    SDKUtilities.DebugLine("[MyMoviesImporter] This appears to be unrated");
                                    newTitle.ParentalRating = "Unrated";
                                    break;
                                case 1:
                                    SDKUtilities.DebugLine("[MyMoviesImporter] This appears to be rated G");
                                    newTitle.ParentalRating = "G";
                                    break;
                                case 2:
                                    SDKUtilities.DebugLine("[MyMoviesImporter] I have no idea what rating this is");
                                    break;
                                case 3:
                                    SDKUtilities.DebugLine("[MyMoviesImporter] This appears to be rated PG");
                                    newTitle.ParentalRating = "PG";
                                    break;
                                case 4:
                                    SDKUtilities.DebugLine("[MyMoviesImporter] This appears to be rated PG13");
                                    newTitle.ParentalRating = "PG13";
                                    break;
                                case 5:
//.........这里部分代码省略.........
开发者ID:peeboo,项目名称:open-media-library,代码行数:101,代码来源:MyMoviesImporter.cs

示例15: CreateNamespace

		public string CreateNamespace(string prefix, string namespaceUri, XPathNavigator source)
		{
			if (string.IsNullOrEmpty(namespaceUri) == false)
			{
				source = source.Clone();
				source.MoveToRoot();
				source.MoveToChild(XPathNodeType.Element);

				if (string.IsNullOrEmpty(prefix))
					prefix = AddNamespace(namespaceUri);

				var existing = source.GetNamespace(prefix);
				if (existing == namespaceUri) return prefix;
				if (string.IsNullOrEmpty(existing) == false) return null;

				source.CreateAttribute("xmlns", prefix, "", namespaceUri);
			}
			return prefix;
		}
开发者ID:n2cms,项目名称:Castle.Core,代码行数:19,代码来源:XPathContext.cs


注:本文中的System.Xml.XPath.XPathNavigator.MoveToChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。