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


C# XElement.XPathSelectElement方法代碼示例

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


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

示例1: SetUp

        public void SetUp()
        {
            // ARRANGE
            var assemblyPath = typeof(TestManualElementsCommand).Assembly.Location;
            var cmdletXmlHelpPath = Path.ChangeExtension(assemblyPath, ".dll-Help.xml");
            if (File.Exists(cmdletXmlHelpPath))
            {
                File.Delete(cmdletXmlHelpPath);
            }

            // ACT
            var options = new Options(false, assemblyPath);
            var engine = new Engine();
            engine.GenerateHelp(options);

            // ASSERT
            Assert.That(File.Exists(cmdletXmlHelpPath));

            using (var stream = File.OpenRead(cmdletXmlHelpPath))
            {
                var document = XDocument.Load(stream);
                rootElement = document.Root;
            }
            testManualElementsCommandElement = rootElement.XPathSelectElement("command:command[command:details/command:name/text() = 'Test-ManualElements']", resolver);
            testMamlElementsCommandElement = rootElement.XPathSelectElement("command:command[command:details/command:name/text() = 'Test-MamlElements']", resolver);
            testReferencesCommandElement = rootElement.XPathSelectElement("command:command[command:details/command:name/text() = 'Test-References']", resolver);
            testInputTypesCommandElement = rootElement.XPathSelectElement("command:command[command:details/command:name/text() = 'Test-InputTypes']", resolver);
        }
開發者ID:mowensoft,項目名稱:XmlDoc2CmdletDoc,代碼行數:28,代碼來源:AcceptanceTests.cs

示例2: Parse

		public static AssemblyDoc Parse(XElement doc)
		{
			return new AssemblyDoc
			{
				Name = doc.XPathSelectElement("assembly/name").Value,
				Types = ParseMembers(doc.XPathSelectElement("members"))
			};
		}
開發者ID:RakotVT,項目名稱:StockSharp,代碼行數:8,代碼來源:AssemblyDoc.cs

示例3: FromXml

        public static PersonalConfiguration FromXml(XElement root)
        {
            lock (m_syncRoot) {
                string name = root.XPathSelectElement("./configuration/personalConfiguration/name").Value;
                string address = root.XPathSelectElement("./configuration/personalConfiguration/address").Value;

                return new PersonalConfiguration(name, address);
            }
        }
開發者ID:gangelo,項目名稱:BillingUtils,代碼行數:9,代碼來源:PersonalConfiguration.cs

示例4: FromXml

        public static DirectoriesConfiguration FromXml(XElement root)
        {
            lock (m_syncRoot) {
                XElement xElement = null;

                xElement = root.XPathSelectElement("./configuration/directoriesConfiguration/defaultTouchDirectory");
                string defaultTouchDirectory = xElement.Value;

                xElement = root.XPathSelectElement("./configuration/directoriesConfiguration/lastTouchDirectory");
                string lastTouchDirectory = xElement.Value;

                return new DirectoriesConfiguration(defaultTouchDirectory, lastTouchDirectory);
            }
        }
開發者ID:gangelo,項目名稱:Touch,代碼行數:14,代碼來源:DirectoriesConfiguration.cs

示例5: FromXml

        public static ExceptionRecord FromXml(XElement exceptionData)
        {
            if (exceptionData == null)
                return null;

            return new ExceptionRecord {
                Type = exceptionData.XPathSelectElement("type[1]").Value,
                Message = exceptionData.XPathSelectElement("message[1]").Value,
                Stacktrace = exceptionData.XPathSelectElement("stacktrace[1]").Value
                    .Split(new[] { "\n" }, StringSplitOptions.RemoveEmptyEntries).ToList(),
                InnerEception = !string.IsNullOrEmpty(exceptionData.XPathSelectElement("innerexception[1]").Value)
                    ? FromXml(exceptionData.XPathSelectElement("innerexception[1]").Elements().First())
                    : null
            };
        }
開發者ID:wurdum,項目名稱:deployer,代碼行數:15,代碼來源:ExceptionRecord.cs

示例6: ParagraphIsStageDirection

		public bool ParagraphIsStageDirection (XElement paragraph)
		{
			var next = paragraph.XPathSelectElement ("key[text()='speaker']").NextNode as XElement;
			var body = next.Value;

			return body == "STAGE DIRECTION";
		}
開發者ID:CBrauer,項目名稱:monotouch-samples,代碼行數:7,代碼來源:Page.cs

示例7: FromXml

 public static GeneralConfiguration FromXml(XElement root)
 {
     lock (m_syncRoot) {
         XElement xElement = root.XPathSelectElement("./configuration/generalConfiguration/useRecursionByDefault");
         bool useRecursionByDefault = Convert.ToBoolean(xElement.Attribute("useRecursionByDefault").Value);
         return new GeneralConfiguration(useRecursionByDefault);
     }
 }
開發者ID:gangelo,項目名稱:Touch,代碼行數:8,代碼來源:GeneralConfiguration.cs

示例8: DoesElementExist

 public static bool DoesElementExist(XElement xElement, string xPathStatement)
 {
     bool result = false;
     if (xElement.XPathSelectElement(xPathStatement) != null)
     {
         result = true;
     }
     return result;
 }
開發者ID:WilliamCopland,項目名稱:YPILIS,代碼行數:9,代碼來源:XmlHelper.cs

示例9: DoesElementHaveValue

 public static bool DoesElementHaveValue(XElement xElement, string xPathStatement)
 {
     bool result = false;
     if (string.IsNullOrEmpty(xElement.XPathSelectElement(xPathStatement).Value) == false)
     {
         result = true;
     }
     return result;
 }
開發者ID:WilliamCopland,項目名稱:YPILIS,代碼行數:9,代碼來源:XmlHelper.cs

示例10: CardViewModel

 public CardViewModel(XElement e)
 {
     Title = (string)e.XPathSelectElement("title");
     IssueKey = (string)e.XPathSelectElement("key");
     ProjectName = (string)e.XPathSelectElement("project");
     Assignee = (string)e.XPathSelectElement("assignee");
     Summary = (string)e.XPathSelectElement("summary");
     OriginalEstimate = (string)e.XPathSelectElement("timeoriginalestimate");
     Status = (string)e.XPathSelectElement("status");
     ProjectKey = (string)e.XPathSelectElement("project").Attribute("key");
 }
開發者ID:axine,項目名稱:SprintCardGenerator,代碼行數:11,代碼來源:CardViewModel.cs

示例11: ParseErrorInfo

        private ErrorInfo ParseErrorInfo(XElement errorInfoXmlElement)
        {
            XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager(new NameTable());
            xmlNamespaceManager.AddNamespace("prefix", ns.NamespaceName);

            errorInfoXmlElement = errorInfoXmlElement.Element(ns + "Output");
            
            XElement messageElement = errorInfoXmlElement.XPathSelectElement("prefix:ErrorInfo/prefix:Message", xmlNamespaceManager);
            
            string message = (messageElement != null) ? messageElement.Value : null;

            XElement stackTraceElement = errorInfoXmlElement.XPathSelectElement("prefix:ErrorInfo/prefix:StackTrace", xmlNamespaceManager);
            
            string stackTrace = (stackTraceElement != null) ? stackTraceElement.Value : null;

            XElement stdOutElement = errorInfoXmlElement.XPathSelectElement("prefix:StdOut", xmlNamespaceManager);
            
            string stdOut = (stdOutElement != null) ? stdOutElement.Value : null;

            return new ErrorInfo(message, stackTrace, stdOut);
        }
開發者ID:allure-framework,項目名稱:allure-mstest-adapter,代碼行數:21,代碼來源:TRXParser.cs

示例12: GetBooleanValue

 public static bool GetBooleanValue(XElement xElement, string xPathStatement, bool defaultValue)
 {
     bool result = defaultValue;
     if (DoesElementExist(xElement, xPathStatement) == true)
     {
         if (DoesElementHaveValue(xElement, xPathStatement) == true)
         {
             result = Convert.ToBoolean(xElement.XPathSelectElement(xPathStatement).Value);
         }
     }
     return result;
 }
開發者ID:WilliamCopland,項目名稱:YPILIS,代碼行數:12,代碼來源:XmlHelper.cs

示例13: GetIntValue

 public static int GetIntValue(XElement xElement, string xPathStatement, int defaultValue)
 {
     int result = defaultValue;
     if (DoesElementExist(xElement, xPathStatement) == true)
     {
         if (DoesElementHaveValue(xElement, xPathStatement) == true)
         {
             result = Convert.ToInt32(xElement.XPathSelectElement(xPathStatement).Value);
         }
     }
     return result;
 }
開發者ID:WilliamCopland,項目名稱:YPILIS,代碼行數:12,代碼來源:XmlHelper.cs

示例14: SetValue

        public static void SetValue(XElement xElement, string xPathStatement, string elementValue)
        {
            if (DoesElementExist(xElement, xPathStatement) == false)
            {
                string[] slashSplit = xPathStatement.Split('/');
                XElement parentElement = xElement.XPathSelectElement('/' + slashSplit[1]);
                AddElement(parentElement, slashSplit[2]);
            }

            XElement element = xElement.XPathSelectElement(xPathStatement);
            element.Value = elementValue;
        }
開發者ID:WilliamCopland,項目名稱:YPILIS,代碼行數:12,代碼來源:XmlHelper.cs

示例15: GetStringValue

 public static string GetStringValue(XElement xElement, string xPathStatement, string defaultValue)
 {
     string result = defaultValue;
     if (DoesElementExist(xElement, xPathStatement) == true)
     {
         if (DoesElementHaveValue(xElement, xPathStatement) == true)
         {
             result = xElement.XPathSelectElement(xPathStatement).Value.ToString();
         }
     }
     return result;
 }
開發者ID:WilliamCopland,項目名稱:YPILIS,代碼行數:12,代碼來源:XmlHelper.cs


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