C# (CSharp) XPathResult Examples

Programming Language: C# (CSharp)
Class/Type: XPathResult
Examples at hotexamples.com: 50
XPathResult is a class in C# used for evaluating XPath expressions against XML documents and returning the result of the evaluation. It is typically used alongside XmlDocument or XPathNavigator classes.

Here are some code examples using XPathResult (in the System.Xml.XPath namespace):

Example 1: Evaluating a simple XPath expression and returning the result as a string
XmlDocument doc = new XmlDocument();
doc.Load("example.xml");

XPathNavigator nav = doc.CreateNavigator();
XPathExpression expr = nav.Compile("//book/title/text()");
XPathResult result = nav.Evaluate(expr) as XPathResult;
string title = result.Value.ToString();

In this example, we load an XML document and create an XPathNavigator to navigate through it. We then compile an XPath expression to select the text of all `` elements, and evaluate the expression using the navigator. Finally, we retrieve the result as a string using the `Value` property of the `XPathResult` object.<br><br><b>Example 2:</b> Evaluating an XPath expression that uses functions and returns multiple values<br><pre style="border:1px solid #888; border-radius: 5px;" class=" language-csharp">XPathNavigator nav = doc.CreateNavigator(); XPathExpression expr = nav.Compile("//book[count(author) > 1]/title/text() | //book[count(author) = 1]/author[1]/name/text()"); XPathNodeIterator result = nav.Select(expr); while (result.MoveNext()) { string value = result.Current.Value; Console.WriteLine(value); } </pre> In this example, we compile an XPath expression that selects the title of books that have more than one author, and the name of the first author for books that only have one author. We evaluate the expression using the navigator and retrieve the result as a `XPathNodeIterator` object. We then loop through the iterator to print out each value. The package/library for XPathResult is built into the .NET framework and does not require any separate installation or package references.</div> <strong>C# (CSharp) XPathResult - 50 examples found</strong>. These are the top rated real world C# (CSharp) examples of <strong>XPathResult</strong> extracted from open source projects. You can rate examples to help us improve the quality of examples. </div> <div class="hidden-xs"> <div id="ezoic-pub-ad-placeholder-130"> </div> </div> </div> <div id="ezoic-pub-ad-placeholder-105"> <div style="text-align: center; margin-top: 10px"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- after-description --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3697522372581514" data-ad-slot="5330879504" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="visible-xs visible-sm visible-md"> <div class="bs-example thin" style="margin-top: 15px"> <div class="bs-example-title">Frequently Used Methods</div> <div class="fields-controls visible-sm visible-xs visible-md"> <a class="btn btn-default fields-show-btn" data-toggle="collapse" href="#fields-panel-mobile" aria-expanded="false" aria-controls="fields-panel">Show</a> <a class="btn btn-default fields-hide-btn" data-toggle="collapse" href="#fields-panel-mobile" aria-expanded="false" aria-controls="fields-panel">Hide</a> </div> </div> <figure class="highlight panel fields-panel collapse" id="fields-panel-mobile"> <div style="overflow: hidden;text-overflow: ellipsis;"> <a rel="nofollow" href="https://csharp.hotexamples.com/examples/-/XPathResult/GetNodes/php-xpathresult-getnodes-method-examples.html">GetNodes(1)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a rel="nofollow" href="https://csharp.hotexamples.com/examples/-/XPathResult/GetResultAsBoolean/php-xpathresult-getresultasboolean-method-examples.html">GetResultAsBoolean(1)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a rel="nofollow" href="https://csharp.hotexamples.com/examples/-/XPathResult/GetResultAsNodeset/php-xpathresult-getresultasnodeset-method-examples.html">GetResultAsNodeset(1)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a rel="nofollow" href="https://csharp.hotexamples.com/examples/-/XPathResult/GetResultAsNumber/php-xpathresult-getresultasnumber-method-examples.html">GetResultAsNumber(1)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a rel="nofollow" href="https://csharp.hotexamples.com/examples/-/XPathResult/GetResultAsString/php-xpathresult-getresultasstring-method-examples.html">GetResultAsString(1)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a rel="nofollow" href="https://csharp.hotexamples.com/examples/-/XPathResult/IterateNext/php-xpathresult-iteratenext-method-examples.html">IterateNext(1)</a> </div> </figure> </div> </div> <div class="page-content-container"> <div class="sidebar hidden-xs hidden-sm hidden-md" style="width:300px"> <div id="ezoic-pub-ad-placeholder-101"> <div style="text-align: center; margin-top: 10px"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- left-sidebar-1 --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3697522372581514" data-ad-slot="7161345231" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="bs-example thin"> <div class="bs-example-title"> Frequently Used Methods </div> </div> <figure class="highlight panel fields-panel " id="fields-panel"> <div style="overflow: hidden;text-overflow: ellipsis;"> <a rel="nofollow" href="https://csharp.hotexamples.com/examples/-/XPathResult/GetNodes/php-xpathresult-getnodes-method-examples.html">GetNodes (1)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a rel="nofollow" href="https://csharp.hotexamples.com/examples/-/XPathResult/GetResultAsBoolean/php-xpathresult-getresultasboolean-method-examples.html">GetResultAsBoolean (1)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a rel="nofollow" href="https://csharp.hotexamples.com/examples/-/XPathResult/GetResultAsNodeset/php-xpathresult-getresultasnodeset-method-examples.html">GetResultAsNodeset (1)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a rel="nofollow" href="https://csharp.hotexamples.com/examples/-/XPathResult/GetResultAsNumber/php-xpathresult-getresultasnumber-method-examples.html">GetResultAsNumber (1)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a rel="nofollow" href="https://csharp.hotexamples.com/examples/-/XPathResult/GetResultAsString/php-xpathresult-getresultasstring-method-examples.html">GetResultAsString (1)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a rel="nofollow" href="https://csharp.hotexamples.com/examples/-/XPathResult/IterateNext/php-xpathresult-iteratenext-method-examples.html">IterateNext (1)</a> </div> </figure> <div id="ezoic-pub-ad-placeholder-102"> <div style="text-align: center; margin-bottom: 10px"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- left-sidebar-2 --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3697522372581514" data-ad-slot="7075206013" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="hidden-xs hidden-sm"> <div class="bs-example thin"> <div class="bs-example-title">Related</div> </div> <figure class="highlight panel"> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://csharp.hotexamples.com/examples/Machine.Specifications.Runner/SpecificationInfo/-/php-specificationinfo-class-examples.html">SpecificationInfo</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://csharp.hotexamples.com/examples/SiliconStudio.Xenko.Audio/AudioEmitterSoundController/-/php-audioemittersoundcontroller-class-examples.html">AudioEmitterSoundController</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://csharp.hotexamples.com/examples/-/FavouriteClick/-/php-favouriteclick-class-examples.html">FavouriteClick</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://csharp.hotexamples.com/examples/Server.Misc/HumilityTimer/-/php-humilitytimer-class-examples.html">HumilityTimer</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://csharp.hotexamples.com/examples/ZohoPeopleTimeLogger.ViewModel/MonthPickerViewModel/-/php-monthpickerviewmodel-class-examples.html">MonthPickerViewModel</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://csharp.hotexamples.com/examples/DarkRoom.Utility/CUITweener/-/php-cuitweener-class-examples.html">CUITweener</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://csharp.hotexamples.com/examples/MyLittleAzUrlAPI.Models/LittleUrlAzure/-/php-littleurlazure-class-examples.html">LittleUrlAzure</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://csharp.hotexamples.com/examples/-/PTB.Entities.LogSuCoPhong/-/php-ptb.entities.logsucophong-class-examples.html">PTB.Entities.LogSuCoPhong</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://csharp.hotexamples.com/examples/-/PointAmf/-/php-pointamf-class-examples.html">PointAmf</a> </div> </figure> </div> <div id="ezoic-pub-ad-placeholder-117"> </div> <div class="hidden-xs hidden-sm"> <div class="bs-example thin"> <div class="bs-example-title">Related in langs</div> </div> <figure class="highlight panel"> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://hotexamples.com/examples/magento.catalogimportexport.model.import/UploaderFactory/-/php-uploaderfactory-class-examples.html">UploaderFactory (PHP)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://hotexamples.com/examples/-/Watts/-/php-watts-class-examples.html">Watts (PHP)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://cpp.hotexamples.com/examples/-/-/CreateWindowExW/cpp-createwindowexw-function-examples.html">CreateWindowExW (C++)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://cpp.hotexamples.com/examples/-/-/bli_thrinfo_grow/cpp-bli_thrinfo_grow-function-examples.html">bli_thrinfo_grow (C++)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://golang.hotexamples.com/examples/github.com.daveblooman.slingshot.godeps._workspace.src.github.com.aws.aws-sdk-go.internal.protocol.restxml/-/Unmarshal/golang-unmarshal-function-examples.html">Unmarshal (Go)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://golang.hotexamples.com/examples/goshawkdb.io.common/-/MakeVarUUId/golang-makevaruuid-function-examples.html">MakeVarUUId (Go)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://java.hotexamples.com/examples/game.world.creature.clyde.animation/ClydeFrames/-/java-clydeframes-class-examples.html">ClydeFrames (Java)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://java.hotexamples.com/examples/de.mpg.mpi_inf.bioinf.netanalyzer.data/NetworkInterpretation/-/java-networkinterpretation-class-examples.html">NetworkInterpretation (Java)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://python.hotexamples.com/examples/scode.cache/-/clear_rank/python-clear_rank-function-examples.html">clear_rank (Python)</a> </div> <div style="overflow: hidden;text-overflow: ellipsis;"> <a href="https://python.hotexamples.com/examples/pcs.cli.common.middleware/-/build/python-build-function-examples.html">build (Python)</a> </div> </figure> </div> <div id="ezoic-pub-ad-placeholder-116"> </div> </div> <div class="main-content"> <div class="addthis_inline_share_toolbox_o6yp"></div> <div id="ezoic-pub-ad-placeholder-106"> </div> <div class="example-item" id="0xf3bf699d46b3d26cdace93b9cfb8acd3cf614841a0f97243f1dec6c8642de2c4-45,,69,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #1</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_1" data-hash="0xf3bf699d46b3d26cdace93b9cfb8acd3cf614841a0f97243f1dec6c8642de2c4" data-area="45,,69,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '1')" class="rating-up btn btn-success" data-id="rating_1"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'1')" class="rating-down btn btn-danger" data-id="rating_1"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xf3bf699d46b3d26cdace93b9cfb8acd3cf614841a0f97243f1dec6c8642de2c4-45,,69,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xf3bf699d46b3d26cdace93b9cfb8acd3cf614841a0f97243f1dec6c8642de2c4&fullName=System.ServiceModel%2FSystem%2FServiceModel%2FXPathResult.cs&project=pritesh-mandowara-sp%2FDecompliedDotNetLibraries')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fpritesh-mandowara-sp%2FDecompliedDotNetLibraries%2Fblob%2Fmaster%2FSystem.ServiceModel%2FSystem%2FServiceModel%2FXPathResult.cs">XPathResult.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fpritesh-mandowara-sp%2FDecompliedDotNetLibraries">pritesh-mandowara-sp/DecompliedDotNetLibraries</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="1"> <pre class="line-numbers language-csharp" data-end="69" data-start="46" data-highlight="48"> internal XPathResult Copy() { XPathResult result = new XPathResult { resultType = this.resultType }; switch (this.resultType) { case XPathResultType.Number: result.numberResult = this.numberResult; return result; case XPathResultType.String: result.stringResult = this.stringResult; return result; case XPathResultType.Boolean: result.boolResult = this.boolResult; return result; case XPathResultType.NodeSet: result.nodeSetResult = this.nodeSetResult.Clone(); return result; } throw Fx.AssertAndThrow("Unexpected result type."); }</pre> </div> </figure> </div> <div id="ezoic-pub-ad-placeholder-107"> <div style="text-align: center;margin-bottom: 10px"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- after-example-1 --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3697522372581514" data-ad-slot="4981531786" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="example-item" id="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-49,,78,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #2</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_2" data-hash="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f" data-area="49,,78,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '2')" class="rating-up btn btn-success" data-id="rating_2"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'2')" class="rating-down btn btn-danger" data-id="rating_2"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-49,,78,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs">PathPredicatePositionTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="2"> <pre class="line-numbers language-csharp" data-end="78" data-start="50" data-highlight="55"> public static void UsingPositionFunctionTest62() { var xml = "books.xml"; var startingNodePath = "/bookstore"; var testExpression = @"descendant::node()[position()=7 or position()=2]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "author", Name = "author", HasNameTable = true, Value = "\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t" }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div id="ezoic-pub-ad-placeholder-108"> <div style="text-align: center;"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- after-example-2 --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3697522372581514" data-ad-slot="7155150962" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="example-item" id="0xe8bf912a65a1f6579bffe5dcab2fd2afbf887d031f73be45759cad8356886f5b-28,,37,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #3</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_3" data-hash="0xe8bf912a65a1f6579bffe5dcab2fd2afbf887d031f73be45759cad8356886f5b" data-area="28,,37,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '3')" class="rating-up btn btn-success" data-id="rating_3"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'3')" class="rating-down btn btn-danger" data-id="rating_3"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xe8bf912a65a1f6579bffe5dcab2fd2afbf887d031f73be45759cad8356886f5b-28,,37,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xe8bf912a65a1f6579bffe5dcab2fd2afbf887d031f73be45759cad8356886f5b&fullName=src%2FCommon%2Ftests%2FSystem.Xml.XPath%2FMiscWithEncodings.cs&project=svcgany1%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fsvcgany1%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FMiscWithEncodings.cs">MiscWithEncodings.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fsvcgany1%2Fcorefx">svcgany1/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="3"> <pre class="line-numbers language-csharp" data-end="37" data-start="29" data-highlight="35"> public static void AbbreviatedSyntaxTest125() { TestInitialize(); var xml = "XQL_Orders_j1.xml"; var testExpression = @"OrderIDs/CustomerIDs/EmployeeIDs/OrderDates/OrderDate[.='11/16/94']"; var expected = new XPathResult(0); Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div id="ezoic-pub-ad-placeholder-109"> <div style="text-align: center;"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- after-example-3 --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3697522372581514" data-ad-slot="8699811701" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="example-item" id="0xe8336a247fe611662db769b6059a3dfe26ea5876d58adc0cb4f428c596333d41-21,,73,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #4</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_4" data-hash="0xe8336a247fe611662db769b6059a3dfe26ea5876d58adc0cb4f428c596333d41" data-area="21,,73,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '4')" class="rating-up btn btn-success" data-id="rating_4"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'4')" class="rating-down btn btn-danger" data-id="rating_4"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xe8336a247fe611662db769b6059a3dfe26ea5876d58adc0cb4f428c596333d41-21,,73,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xe8336a247fe611662db769b6059a3dfe26ea5876d58adc0cb4f428c596333d41&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathAxesTests.cs&project=noahfalk%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathAxesTests.cs">PathAxesTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx">noahfalk/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="4"> <pre class="line-numbers language-csharp" data-end="73" data-start="22" data-highlight="31"> public static void AxesTest11() { var xml = "xp001.xml"; var startingNodePath = "/Doc/Chap/Para/Para/Origin"; var testExpression = @"ancestor::*"; var namespaceManager = new XmlNamespaceManager(new NameTable()); namespaceManager.AddNamespace("book", "http://book.htm"); namespaceManager.AddNamespace("movie", "http://movie.htm"); var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Doc", Name = "Doc", HasNameTable = true, Value = "\n XPath test\n This shall test XPath test\n \n XPath test\n First paragraph Nested Paragraph End of first paragraph \n Second paragraph \n \n \n XPath test\n Direct content\n \n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Chap", Name = "Chap", HasNameTable = true, Value = "\n XPath test\n First paragraph Nested Paragraph End of first paragraph \n Second paragraph \n " }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Para", Name = "Para", HasNameTable = true, Value = "First paragraph Nested Paragraph End of first paragraph " }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Para", Name = "Para", HasNameTable = true, Value = " Nested Paragraph " }); ; Utils.XPathNodesetTest(xml, testExpression, expected, namespaceManager: namespaceManager, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div id="ezoic-pub-ad-placeholder-110"> </div> <div class="example-item" id="0xdec8865a7d45874488dc10f5d6e225896298f36193460832e7aee2942499514e-67,,78,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #5</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_5" data-hash="0xdec8865a7d45874488dc10f5d6e225896298f36193460832e7aee2942499514e" data-area="67,,78,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '5')" class="rating-up btn btn-success" data-id="rating_5"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'5')" class="rating-down btn btn-danger" data-id="rating_5"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xdec8865a7d45874488dc10f5d6e225896298f36193460832e7aee2942499514e-67,,78,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xdec8865a7d45874488dc10f5d6e225896298f36193460832e7aee2942499514e&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathNodeTests.cs&project=noahfalk%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathNodeTests.cs">PathNodeTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx">noahfalk/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="5"> <pre class="line-numbers language-csharp" data-end="78" data-start="68" data-highlight="73"> public static void NodeTestsTest82() { var xml = "xp003.xml"; var startingNodePath = "/Doc"; var testExpression = @"descendant::comment()"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Comment, HasNameTable = true, Value = " Doc Comment " }, new XPathResultToken { NodeType = XPathNodeType.Comment, HasNameTable = true, Value = " Chap Comment " }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div id="ezoic-pub-ad-placeholder-111"> </div> <div class="example-item" id="0xcc89a751810fec42470dc0bbcd334441e131d910a9ea37d49227190837953ed4-21,,38,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #6</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_6" data-hash="0xcc89a751810fec42470dc0bbcd334441e131d910a9ea37d49227190837953ed4" data-area="21,,38,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '6')" class="rating-up btn btn-success" data-id="rating_6"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'6')" class="rating-down btn btn-danger" data-id="rating_6"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xcc89a751810fec42470dc0bbcd334441e131d910a9ea37d49227190837953ed4-21,,38,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xcc89a751810fec42470dc0bbcd334441e131d910a9ea37d49227190837953ed4&fullName=src%2FCommon%2Ftests%2FSystem.Xml.XPath%2FPathAxeComplexExprTests.cs&project=nandhanurrevanth%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnandhanurrevanth%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FPathAxeComplexExprTests.cs">PathAxeComplexExprTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnandhanurrevanth%2Fcorefx">nandhanurrevanth/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="6"> <pre class="line-numbers language-csharp" data-end="38" data-start="22" data-highlight="27"> public static void ComplexExpressionsTest31() { var xml = "books.xml"; var startingNodePath = "/bookstore/book[1]"; var testExpression = @"child::author/ancestor::book/attribute::style[.='autobiography']"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "style", Name = "style", HasNameTable = true, Value = "autobiography" }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div class="example-item" id="0x2f6fa3da01bab71070922d484e1441674a45d42c0cadd9e44046dd89b5f3cff9-66,,83,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #7</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_7" data-hash="0x2f6fa3da01bab71070922d484e1441674a45d42c0cadd9e44046dd89b5f3cff9" data-area="66,,83,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '7')" class="rating-up btn btn-success" data-id="rating_7"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'7')" class="rating-down btn btn-danger" data-id="rating_7"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x2f6fa3da01bab71070922d484e1441674a45d42c0cadd9e44046dd89b5f3cff9-66,,83,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x2f6fa3da01bab71070922d484e1441674a45d42c0cadd9e44046dd89b5f3cff9&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FNodeSetMatchesTests.cs&project=noahfalk%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FNodeSetMatchesTests.cs">NodeSetMatchesTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx">noahfalk/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="7"> <pre class="line-numbers language-csharp" data-end="83" data-start="67" data-highlight="72"> public static void MatchesTest234() { var xml = "xp005.xml"; var startingNodePath = "Doc/Test1"; var testExpression = @"attribute::*[last() - 1]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "Attr4", Name = "Attr4", HasNameTable = true, Value = "Fourth" }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div class="example-item" id="0x8b6497d1fac0ff9aaf5083fc22c429da5bef41bce24eb790e9b87b60ba22c853-72,,89,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #8</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_8" data-hash="0x8b6497d1fac0ff9aaf5083fc22c429da5bef41bce24eb790e9b87b60ba22c853" data-area="72,,89,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '8')" class="rating-up btn btn-success" data-id="rating_8"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'8')" class="rating-down btn btn-danger" data-id="rating_8"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x8b6497d1fac0ff9aaf5083fc22c429da5bef41bce24eb790e9b87b60ba22c853-72,,89,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x8b6497d1fac0ff9aaf5083fc22c429da5bef41bce24eb790e9b87b60ba22c853&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FNodeSetFunctionsTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FNodeSetFunctionsTests.cs">NodeSetFunctionsTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="8"> <pre class="line-numbers language-csharp" data-end="89" data-start="73" data-highlight="78"> public static void NodeSetFunctionsTest223() { var xml = "xp005.xml"; var startingNodePath = "Doc/Test1"; var testExpression = @"attribute::*[last()]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "Attr5", Name = "Attr5", HasNameTable = true, Value = "Last" }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div class="example-item" id="0xe8bf912a65a1f6579bffe5dcab2fd2afbf887d031f73be45759cad8356886f5b-43,,61,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #9</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_9" data-hash="0xe8bf912a65a1f6579bffe5dcab2fd2afbf887d031f73be45759cad8356886f5b" data-area="43,,61,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '9')" class="rating-up btn btn-success" data-id="rating_9"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'9')" class="rating-down btn btn-danger" data-id="rating_9"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xe8bf912a65a1f6579bffe5dcab2fd2afbf887d031f73be45759cad8356886f5b-43,,61,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xe8bf912a65a1f6579bffe5dcab2fd2afbf887d031f73be45759cad8356886f5b&fullName=src%2FCommon%2Ftests%2FSystem.Xml.XPath%2FMiscWithEncodings.cs&project=svcgany1%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fsvcgany1%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FMiscWithEncodings.cs">MiscWithEncodings.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fsvcgany1%2Fcorefx">svcgany1/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="9"> <pre class="line-numbers language-csharp" data-end="61" data-start="44" data-highlight="50"> public static void GlobalizationTest5612() { TestInitialize(); var xml = "Russian_problem_chars.xml"; var testExpression = @"//root[contains(text(), ""?? ¤ ?? ?? © ? ® ??"")]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "root", Name = "root", HasNameTable = true, Value = "\n?? ¤ ?? ?? © ? ® ?? \n" }); Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0x8b73dd02cdac6a9ee951e5c569ea69d7c114da299692344af2e474a12712e142-47,,65,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #10</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_10" data-hash="0x8b73dd02cdac6a9ee951e5c569ea69d7c114da299692344af2e474a12712e142" data-area="47,,65,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '10')" class="rating-up btn btn-success" data-id="rating_10"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'10')" class="rating-down btn btn-danger" data-id="rating_10"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x8b73dd02cdac6a9ee951e5c569ea69d7c114da299692344af2e474a12712e142-47,,65,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x8b73dd02cdac6a9ee951e5c569ea69d7c114da299692344af2e474a12712e142&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FBasicsTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FBasicsTests.cs">BasicsTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="10"> <pre class="line-numbers language-csharp" data-end="65" data-start="48" data-highlight="53"> public static void BasicsTest162() { var xml = "xp001.xml"; var startingNodePath = "/Doc"; var testExpression = @"child::*[(2 * (2 - (3 div (1 + 2))))]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Summary", Name = "Summary", HasNameTable = true, Value = "This shall test XPath test" }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div class="example-item" id="0x8b73dd02cdac6a9ee951e5c569ea69d7c114da299692344af2e474a12712e142-22,,40,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #11</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_11" data-hash="0x8b73dd02cdac6a9ee951e5c569ea69d7c114da299692344af2e474a12712e142" data-area="22,,40,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '11')" class="rating-up btn btn-success" data-id="rating_11"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'11')" class="rating-down btn btn-danger" data-id="rating_11"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x8b73dd02cdac6a9ee951e5c569ea69d7c114da299692344af2e474a12712e142-22,,40,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x8b73dd02cdac6a9ee951e5c569ea69d7c114da299692344af2e474a12712e142&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FBasicsTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FBasicsTests.cs">BasicsTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="11"> <pre class="line-numbers language-csharp" data-end="40" data-start="23" data-highlight="28"> public static void BasicsTest161() { var xml = "xp001.xml"; var startingNodePath = "/Doc"; var testExpression = @"child::*[((((1 + 2) * 3) - 7) div 2)]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Title", Name = "Title", HasNameTable = true, Value = "XPath test" }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div class="example-item" id="0x8b6497d1fac0ff9aaf5083fc22c429da5bef41bce24eb790e9b87b60ba22c853-47,,65,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #12</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_12" data-hash="0x8b6497d1fac0ff9aaf5083fc22c429da5bef41bce24eb790e9b87b60ba22c853" data-area="47,,65,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '12')" class="rating-up btn btn-success" data-id="rating_12"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'12')" class="rating-down btn btn-danger" data-id="rating_12"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x8b6497d1fac0ff9aaf5083fc22c429da5bef41bce24eb790e9b87b60ba22c853-47,,65,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x8b6497d1fac0ff9aaf5083fc22c429da5bef41bce24eb790e9b87b60ba22c853&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FNodeSetFunctionsTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FNodeSetFunctionsTests.cs">NodeSetFunctionsTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="12"> <pre class="line-numbers language-csharp" data-end="65" data-start="48" data-highlight="53"> public static void NodeSetFunctionsTest222() { var xml = "xp005.xml"; var startingNodePath = "Doc/Test1"; var testExpression = @"child::*[last() - 1]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Child4", Name = "Child4", HasNameTable = true, Value = "Fourth" }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div class="example-item" id="0x66d8255462098aa0d20da1035de6bc371cd7148252cceba4bf4cb0e0307be634-47,,65,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #13</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_13" data-hash="0x66d8255462098aa0d20da1035de6bc371cd7148252cceba4bf4cb0e0307be634" data-area="47,,65,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '13')" class="rating-up btn btn-success" data-id="rating_13"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'13')" class="rating-down btn btn-danger" data-id="rating_13"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x66d8255462098aa0d20da1035de6bc371cd7148252cceba4bf4cb0e0307be634-47,,65,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x66d8255462098aa0d20da1035de6bc371cd7148252cceba4bf4cb0e0307be634&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FCustomerScenariosTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FCustomerScenariosTests.cs">CustomerScenariosTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="13"> <pre class="line-numbers language-csharp" data-end="65" data-start="48" data-highlight="53"> public static void CustomerScenariosTest302() { var xml = "xpC001.xml"; var startingNodePath = "/Book"; var testExpression = @"/Book/Chapter[last()]/Section[1]/Line[last()]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Line", Name = "Line", HasNameTable = true, Value = "Porsche 911" }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div class="example-item" id="0xdfc75181a20af1d988f12d319d103beb09287ba08b8011d5b469c6bdc9b46778-47,,66,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #14</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_14" data-hash="0xdfc75181a20af1d988f12d319d103beb09287ba08b8011d5b469c6bdc9b46778" data-area="47,,66,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '14')" class="rating-up btn btn-success" data-id="rating_14"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'14')" class="rating-down btn btn-danger" data-id="rating_14"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xdfc75181a20af1d988f12d319d103beb09287ba08b8011d5b469c6bdc9b46778-47,,66,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xdfc75181a20af1d988f12d319d103beb09287ba08b8011d5b469c6bdc9b46778&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatesTests.cs&project=noahfalk%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatesTests.cs">PathPredicatesTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx">noahfalk/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="14"> <pre class="line-numbers language-csharp" data-end="66" data-start="48" data-highlight="53"> public static void PredicatesTest102() { var xml = "xp001.xml"; var startingNodePath = "/Doc/Chap/Para/Para/Origin"; var testExpression = @"ancestor::*[3]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Chap", Name = "Chap", HasNameTable = true, Value = "\n XPath test\n First paragraph Nested Paragraph End of first paragraph \n Second paragraph \n " }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div class="example-item" id="0x6c732482570ff7f927751d2fee4f12e79cab4c20f02a61c89056e389655a6da2-21,,40,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #15</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_15" data-hash="0x6c732482570ff7f927751d2fee4f12e79cab4c20f02a61c89056e389655a6da2" data-area="21,,40,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '15')" class="rating-up btn btn-success" data-id="rating_15"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'15')" class="rating-down btn btn-danger" data-id="rating_15"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x6c732482570ff7f927751d2fee4f12e79cab4c20f02a61c89056e389655a6da2-21,,40,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x6c732482570ff7f927751d2fee4f12e79cab4c20f02a61c89056e389655a6da2&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FLexicalStructureTests.cs&project=noahfalk%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FLexicalStructureTests.cs">LexicalStructureTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx">noahfalk/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="15"> <pre class="line-numbers language-csharp" data-end="40" data-start="22" data-highlight="26"> public static void LexicalStructureTest521() { var xml = "books.xml"; var testExpression = @"/*[node ()]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "bookstore", Name = "bookstore", HasNameTable = true, Value = "\n\t\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t\n\t\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t\n\t\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t\n\t\n\t\tRoad and Track\n\t\t3.50\n\t\t\n\t\tYes\n\t\n\t\n\t\tPC Week\n\t\tfree\n\t\tZiff Davis\n\t\n\t\n\t\tPC Magazine\n\t\t3.95\n\t\tZiff Davis\n\t\t\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t\n\t\n\t\n\t\tPC Magazine Best Product of 1997\n\t\n\t\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t\n\t\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t\n\t\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t\n\t\n\t\tTracking Trenton\n\t\t2.50\n\t\t\n\t\n\t\n\t\tTracking Trenton Stocks\n\t\t0.98\n\t\t\n\t\n\t\n\t\tTrenton Today, Trenton Tomorrow\n\t\t\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t\n\t\t6.50\n\t\t\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t\n\t\n\t\n\t\tWho's Who in Trenton\n\t\tRobert Bob\n\t\n\t\n\t\tWhere is Trenton?\n\t\n\t\n\t\tWhere in the world is Trenton?\n\t\n" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-22,,42,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #16</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_16" data-hash="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f" data-area="22,,42,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '16')" class="rating-up btn btn-success" data-id="rating_16"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'16')" class="rating-down btn btn-danger" data-id="rating_16"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-22,,42,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs">PathPredicatePositionTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="16"> <pre class="line-numbers language-csharp" data-end="42" data-start="23" data-highlight="28"> public static void UsingPositionFunctionTest61() { var xml = "books.xml"; var startingNodePath = "/bookstore"; var testExpression = @"child::*[position()=10]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t" }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div class="example-item" id="0xdec8865a7d45874488dc10f5d6e225896298f36193460832e7aee2942499514e-21,,60,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #17</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_17" data-hash="0xdec8865a7d45874488dc10f5d6e225896298f36193460832e7aee2942499514e" data-area="21,,60,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '17')" class="rating-up btn btn-success" data-id="rating_17"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'17')" class="rating-down btn btn-danger" data-id="rating_17"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xdec8865a7d45874488dc10f5d6e225896298f36193460832e7aee2942499514e-21,,60,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xdec8865a7d45874488dc10f5d6e225896298f36193460832e7aee2942499514e&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathNodeTests.cs&project=noahfalk%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathNodeTests.cs">PathNodeTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx">noahfalk/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="17"> <pre class="line-numbers language-csharp" data-end="60" data-start="22" data-highlight="27"> public static void NodeTestsTest81() { var xml = "xp003.xml"; var startingNodePath = "/Doc"; var testExpression = @"descendant::text()"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = "XPath test" }, new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = "XPath test" }, new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = "First paragraph " }, new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = " Nested " }, new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = " Paragraph " }, new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = " End of first paragraph " }, new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = "Second paragraph " }, new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = "XPath test" }, new XPathResultToken { NodeType = XPathNodeType.Text, HasNameTable = true, Value = "\n Direct content\n " }, new XPathResultToken { NodeType = XPathNodeType.Whitespace, HasNameTable = true }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div class="example-item" id="0x856156500c5435ee1d4a3c38de705abc3eeedab3e338572c10ee0f501132b7f6-21,,58,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #18</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_18" data-hash="0x856156500c5435ee1d4a3c38de705abc3eeedab3e338572c10ee0f501132b7f6" data-area="21,,58,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '18')" class="rating-up btn btn-success" data-id="rating_18"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'18')" class="rating-down btn btn-danger" data-id="rating_18"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x856156500c5435ee1d4a3c38de705abc3eeedab3e338572c10ee0f501132b7f6-21,,58,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x856156500c5435ee1d4a3c38de705abc3eeedab3e338572c10ee0f501132b7f6&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FNodeSetsTests.cs&project=noahfalk%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FNodeSetsTests.cs">NodeSetsTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx">noahfalk/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="18"> <pre class="line-numbers language-csharp" data-end="58" data-start="22" data-highlight="27"> public static void NodeSetsTest181() { var xml = "xp001.xml"; var startingNodePath = "/Doc"; var testExpression = @"child::Title | child::Chap"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Title", Name = "Title", HasNameTable = true, Value = "XPath test" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Chap", Name = "Chap", HasNameTable = true, Value = "\n XPath test\n First paragraph Nested Paragraph End of first paragraph \n Second paragraph \n " }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Chap", Name = "Chap", HasNameTable = true, Value = "\n XPath test\n Direct content\n " }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div class="example-item" id="0xfb947d7c070d9e2a0c0148f5bd37315d303b3e2022786abbed6a33be7ffb78f8-21,,56,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #19</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_19" data-hash="0xfb947d7c070d9e2a0c0148f5bd37315d303b3e2022786abbed6a33be7ffb78f8" data-area="21,,56,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '19')" class="rating-up btn btn-success" data-id="rating_19"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'19')" class="rating-down btn btn-danger" data-id="rating_19"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xfb947d7c070d9e2a0c0148f5bd37315d303b3e2022786abbed6a33be7ffb78f8-21,,56,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xfb947d7c070d9e2a0c0148f5bd37315d303b3e2022786abbed6a33be7ffb78f8&fullName=src%2FCommon%2Ftests%2FSystem.Xml.XPath%2FMiscellaneousCasesTests.cs&project=svcgany1%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fsvcgany1%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FMiscellaneousCasesTests.cs">MiscellaneousCasesTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fsvcgany1%2Fcorefx">svcgany1/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="19"> <pre class="line-numbers language-csharp" data-end="56" data-start="22" data-highlight="26"> public static void MiscellaneousCasesTest531() { var xml = "books.xml"; var testExpression = @"/bookstore/magazine[6]/@frequency/following::title"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "Tracking Trenton" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "Tracking Trenton Stocks" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "Trenton Today, Trenton Tomorrow" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xebd8095a571724830f635a70c25895dd5682da2c86788e03f32fd39c6768bfe5-51,,74,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #20</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_20" data-hash="0xebd8095a571724830f635a70c25895dd5682da2c86788e03f32fd39c6768bfe5" data-area="51,,74,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '20')" class="rating-up btn btn-success" data-id="rating_20"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'20')" class="rating-down btn btn-danger" data-id="rating_20"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xebd8095a571724830f635a70c25895dd5682da2c86788e03f32fd39c6768bfe5-51,,74,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xebd8095a571724830f635a70c25895dd5682da2c86788e03f32fd39c6768bfe5&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FSetContextFunctionalTests.cs&project=noahfalk%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FSetContextFunctionalTests.cs">SetContextFunctionalTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fnoahfalk%2Fcorefx">noahfalk/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="20"> <pre class="line-numbers language-csharp" data-end="74" data-start="52" data-highlight="59"> public static void SetContextFunctionalTestsTest432() { var xml = "name.xml"; var testExpression = @"//NSbook:book[1]"; var namespaceManager = new XmlNamespaceManager(new NameTable()); namespaceManager.AddNamespace("NSbook", "http://book.htm"); var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "NSbook:book", NamespaceURI = "http://book.htm", HasNameTable = true, Prefix = "NSbook", Value = "\n\t\t\tA Brief History Of Time\n\t\t" }); ; Utils.XPathNodesetTest(xml, testExpression, expected, namespaceManager: namespaceManager); }</pre> </div> </figure> </div> <div class="example-item" id="0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec-16,,93,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #21</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_21" data-hash="0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec" data-area="16,,93,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '21')" class="rating-up btn btn-success" data-id="rating_21"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'21')" class="rating-down btn btn-danger" data-id="rating_21"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec-16,,93,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec&fullName=corefx-master%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FGlobalizationTests.cs&project=viniciussalmeida%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fviniciussalmeida%2Fcorefx%2Fblob%2Fmaster%2Fcorefx-master%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FGlobalizationTests.cs">GlobalizationTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fviniciussalmeida%2Fcorefx">viniciussalmeida/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="21"> <pre class="line-numbers language-csharp" data-end="93" data-start="17" data-highlight="26"> /// <summary> /// surrogates : xpath testing, return 7 nodes /// </summary> //[Fact(Skip = "Issue #18: Outer loop test")] public static void GlobalizationTest566() { var xml = "Surrogates_1.xml"; var testExpression = @"//Row[Data/text()=""𠀋"" or Data/text()=""𠂢"" or Data/text()=""𠂤"" or Data/text()=""𪀚"" or Data/text()=""𪂂"" or Data/text()=""𪃹"" or Data/text()=""𥇍""] "; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Row", Name = "Row", HasNameTable = true, Value = "\n 𠀋\n 2000B\n D840\n DC0B\n \n \n \n " }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Row", Name = "Row", HasNameTable = true, Value = "\n \n 𠂢\n 200A2\n D840\n DCA2\n \n \n \n " }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Row", Name = "Row", HasNameTable = true, Value = "\n \n 𠂤\n 200A4\n D840\n DCA4\n \n \n \n " }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Row", Name = "Row", HasNameTable = true, Value = "\n \n 𥇍\n 251CD\n D854\n DDCD\n \n \n \n " }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Row", Name = "Row", HasNameTable = true, Value = "\n \n 𪀚\n 2A01A\n D868\n DC1A\n \n \n \n " }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Row", Name = "Row", HasNameTable = true, Value = "\n \n 𪂂\n 2A082\n D868\n DC82\n \n \n \n " }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Row", Name = "Row", HasNameTable = true, Value = "\n \n 𪃹\n 2A0F9\n D868\n DCF9\n \n \n " }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6-205,,386,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #22</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_22" data-hash="0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6" data-area="205,,386,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '22')" class="rating-up btn btn-success" data-id="rating_22"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'22')" class="rating-down btn btn-danger" data-id="rating_22"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6-205,,386,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6')">Show file</a> </div> <div class="example-project-info"> <nobr> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect"></a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="22"> <pre class="line-numbers language-csharp" data-end="386" data-start="206" data-highlight="211"> public static void GlobalizationTest569() { var xml = "JPN_problem_chars_1.xml"; var testExpression = "//char[@Expression=\"\uFF71\" or @Expression=\"\uFF72\" or @Expression=\"\uFF73\" or @Expression=\"\uFF74\" or @Expression=\"\uFF75\" or @Expression=\"\u3042\" or @Expression=\"\u3044\" or @Expression=\"\u3046\" or @Expression=\"\u3048\" or @Expression=\"\u304A\" or @Expression=\"\u30A2\" or @Expression=\"\u30A4\" or @Expression=\"\u30A6\" or @Expression=\"\u30A8\" or @Expression=\"\u30AA\" or @Expression=\"\u4E9C\" or @Expression=\"\u4F0A\" or @Expression=\"\u5B87\" or @Expression=\"\u6C5F\" ]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec-203,,384,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #23</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_23" data-hash="0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec" data-area="203,,384,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '23')" class="rating-up btn btn-success" data-id="rating_23"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'23')" class="rating-down btn btn-danger" data-id="rating_23"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec-203,,384,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec&fullName=corefx-master%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FGlobalizationTests.cs&project=viniciussalmeida%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fviniciussalmeida%2Fcorefx%2Fblob%2Fmaster%2Fcorefx-master%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FGlobalizationTests.cs">GlobalizationTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fviniciussalmeida%2Fcorefx">viniciussalmeida/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="23"> <pre class="line-numbers language-csharp" data-end="384" data-start="204" data-highlight="209"> public static void GlobalizationTest569() { var xml = "JPN_problem_chars_1.xml"; var testExpression = @"//char[@Expression=""ア"" or @Expression=""イ"" or @Expression=""ウ"" or @Expression=""エ"" or @Expression=""オ"" or @Expression=""あ"" or @Expression=""い"" or @Expression=""う"" or @Expression=""え"" or @Expression=""お"" or @Expression=""ア"" or @Expression=""イ"" or @Expression=""ウ"" or @Expression=""エ"" or @Expression=""オ"" or @Expression=""亜"" or @Expression=""伊"" or @Expression=""宇"" or @Expression=""江"" ]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "char", Name = "char", HasNameTable = true }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xc7227d104eb4292e4d94eda060060380568698a5d585af49d0cc72fe1d55f815-22,,139,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #24</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_24" data-hash="0xc7227d104eb4292e4d94eda060060380568698a5d585af49d0cc72fe1d55f815" data-area="22,,139,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '24')" class="rating-up btn btn-success" data-id="rating_24"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'24')" class="rating-down btn btn-danger" data-id="rating_24"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xc7227d104eb4292e4d94eda060060380568698a5d585af49d0cc72fe1d55f815-22,,139,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xc7227d104eb4292e4d94eda060060380568698a5d585af49d0cc72fe1d55f815')">Show file</a> </div> <div class="example-project-info"> <nobr> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect"></a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="24"> <pre class="line-numbers language-csharp" data-end="139" data-start="23" data-highlight="27"> public static void AbbreviatedSyntaxTest121() { var xml = "books.xml"; var testExpression = @"bookstore//title"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "Seven Years in Trenton" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "History of Trenton" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "XQL The Golden Years" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "Road and Track" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "PC Week" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "PC Magazine" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "History of Trenton 2" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "History of Trenton Vol 3" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "How To Fix Computers" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "Tracking Trenton" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "Tracking Trenton Stocks" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "Trenton Today, Trenton Tomorrow" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6-22,,95,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #25</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_25" data-hash="0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6" data-area="22,,95,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '25')" class="rating-up btn btn-success" data-id="rating_25"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'25')" class="rating-down btn btn-danger" data-id="rating_25"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6-22,,95,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6')">Show file</a> </div> <div class="example-project-info"> <nobr> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect"></a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="25"> <pre class="line-numbers language-csharp" data-end="95" data-start="23" data-highlight="28"> public static void GlobalizationTest566() { var xml = "Surrogates_1.xml"; var testExpression = "//Row[Data/text()=\"\uD840\uDC0B\" or Data/text()=\"\uD840\uDCA2\" or Data/text()=\"\uD840\uDCA4\" or Data/text()=\"\uD868\uDC1A\" or Data/text()=\"\uD868\uDC82\" or Data/text()=\"\uD868\uDCF9\" or Data/text()=\"\uD854\uDDCD\"] "; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Row", Name = "Row", HasNameTable = true, Value = "\n \uD840\uDC0B\n 2000B\n D840\n DC0B\n \n \n \n " }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Row", Name = "Row", HasNameTable = true, Value = "\n \n \uD840\uDCA2\n 200A2\n D840\n DCA2\n \n \n \n " }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Row", Name = "Row", HasNameTable = true, Value = "\n \n \uD840\uDCA4\n 200A4\n D840\n DCA4\n \n \n \n " }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Row", Name = "Row", HasNameTable = true, Value = "\n \n \uD854\uDDCD\n 251CD\n D854\n DDCD\n \n \n \n " }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Row", Name = "Row", HasNameTable = true, Value = "\n \n \uD868\uDC1A\n 2A01A\n D868\n DC1A\n \n \n \n " }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Row", Name = "Row", HasNameTable = true, Value = "\n \n \uD868\uDC82\n 2A082\n D868\n DC82\n \n \n \n " }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "Row", Name = "Row", HasNameTable = true, Value = "\n \n \uD868\uDCF9\n 2A0F9\n D868\n DCF9\n \n \n " }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec-469,,533,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #26</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_26" data-hash="0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec" data-area="469,,533,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '26')" class="rating-up btn btn-success" data-id="rating_26"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'26')" class="rating-down btn btn-danger" data-id="rating_26"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec-469,,533,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec&fullName=corefx-master%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FGlobalizationTests.cs&project=viniciussalmeida%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fviniciussalmeida%2Fcorefx%2Fblob%2Fmaster%2Fcorefx-master%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FGlobalizationTests.cs">GlobalizationTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fviniciussalmeida%2Fcorefx">viniciussalmeida/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="26"> <pre class="line-numbers language-csharp" data-end="533" data-start="470" data-highlight="475"> public static void GlobalizationTest5613() { var xml = "KOR_problem_chars_b.xml"; var testExpression = @"root/V[contains(text(), ""한글"") or text()=""は꾜は꾜は꾜は꾜は꾜"" or contains(text(), ""詰詰"") or contains(text(), ""檍也"") or contains(text(), ""가나 가"") or contains(text(), ""Junja"")]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "한글" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "は꾜は꾜は꾜は꾜は꾜" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "詰詰詰詰" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "言檍也言檍也言檍也" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "가나 가나 가나 가나 가나 가나" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "Junja" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xf6d66735bf3628c8817f6658cb36f3de657ac5e49700cea7ddd9fe236991c893-165,,252,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #27</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_27" data-hash="0xf6d66735bf3628c8817f6658cb36f3de657ac5e49700cea7ddd9fe236991c893" data-area="165,,252,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '27')" class="rating-up btn btn-success" data-id="rating_27"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'27')" class="rating-down btn btn-danger" data-id="rating_27"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xf6d66735bf3628c8817f6658cb36f3de657ac5e49700cea7ddd9fe236991c893-165,,252,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xf6d66735bf3628c8817f6658cb36f3de657ac5e49700cea7ddd9fe236991c893')">Show file</a> </div> <div class="example-project-info"> <nobr> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect"></a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="27"> <pre class="line-numbers language-csharp" data-end="252" data-start="166" data-highlight="170"> public void PredicatesTest1041() { var xml = "xql_orders-flat-200a.xml"; var testExpression = @"/ROOT/OrderIDs[OrderID/@CollatingOrder>=1033]/OrderID/@CollatingOrder"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "CollatingOrder", Name = "CollatingOrder", HasNameTable = true, Value = "1033" }, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "CollatingOrder", Name = "CollatingOrder", HasNameTable = true, Value = "1033" }, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "CollatingOrder", Name = "CollatingOrder", HasNameTable = true, Value = "1034" }, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "CollatingOrder", Name = "CollatingOrder", HasNameTable = true, Value = "1033" }, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "CollatingOrder", Name = "CollatingOrder", HasNameTable = true, Value = "1034" }, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "CollatingOrder", Name = "CollatingOrder", HasNameTable = true, Value = "1034" }, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "CollatingOrder", Name = "CollatingOrder", HasNameTable = true, Value = "1033" }, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "CollatingOrder", Name = "CollatingOrder", HasNameTable = true, Value = "1033" }, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "CollatingOrder", Name = "CollatingOrder", HasNameTable = true, Value = "1033" }, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "CollatingOrder", Name = "CollatingOrder", HasNameTable = true, Value = "1033" }); Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-5461,,5544,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #28</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_28" data-hash="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f" data-area="5461,,5544,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '28')" class="rating-up btn btn-success" data-id="rating_28"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'28')" class="rating-down btn btn-danger" data-id="rating_28"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-5461,,5544,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs">PathPredicatePositionTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="28"> <pre class="line-numbers language-csharp" data-end="5544" data-start="5462" data-highlight="5466"> public static void UsingPositionFunctionTest685() { var xml = "books.xml"; var testExpression = @"//book/following-sibling::*[position()=1][position()=last()][1]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tRoad and Track\n\t\t3.50\n\t\t\n\t\tYes\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tTracking Trenton\n\t\t2.50\n\t\t\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "my:book", NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/", HasNameTable = true, Prefix = "my", Value = "\n\t\tWho's Who in Trenton\n\t\tRobert Bob\n\t" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6-541,,605,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #29</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_29" data-hash="0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6" data-area="541,,605,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '29')" class="rating-up btn btn-success" data-id="rating_29"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'29')" class="rating-down btn btn-danger" data-id="rating_29"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6-541,,605,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6')">Show file</a> </div> <div class="example-project-info"> <nobr> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect"></a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="29"> <pre class="line-numbers language-csharp" data-end="605" data-start="542" data-highlight="547"> public static void GlobalizationTest5614() { var xml = "Single_byte_problem_chars_b.xml"; var testExpression = "//V[contains(text(), \"\u00F6\u00DC\u00DF\") or text()=\"\u00A9 \u00AE\" or contains(text(), \"\u00BF\u00BE\u00D5\") or contains(text(), \"\u00C4\u00E4\u00D6\u00A7\u00B2\u00B3@\u00B5\") or contains(text(), \"\u00E5E5\u00E5\") or contains(text(), \"\u2122\")]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "\u00F6\u00DC\u00DF" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "\u00A9 \u00AE" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "\u00BF\u00BE\u00D5" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "\u00C4\u00E4\u00D6\u00A7\u00B2\u00B3@\u00B5" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "\u00E5E5\u00E5" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "\u2122 \u00A9\u00AD\u00AE" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0x6803b8aea3ef6d97c4f87a650228d00e263c6591b096377abf2e04030daa7327-66,,128,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #30</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_30" data-hash="0x6803b8aea3ef6d97c4f87a650228d00e263c6591b096377abf2e04030daa7327" data-area="66,,128,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '30')" class="rating-up btn btn-success" data-id="rating_30"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'30')" class="rating-down btn btn-danger" data-id="rating_30"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x6803b8aea3ef6d97c4f87a650228d00e263c6591b096377abf2e04030daa7327-66,,128,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x6803b8aea3ef6d97c4f87a650228d00e263c6591b096377abf2e04030daa7327&fullName=integriert-master%2FSamples%2FMainWindow.xaml.cs&project=PIM4%2Fintegriert')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FPIM4%2Fintegriert%2Fblob%2Fmaster%2Fintegriert-master%2FSamples%2FMainWindow.xaml.cs">MainWindow.xaml.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FPIM4%2Fintegriert">PIM4/integriert</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="30"> <pre class="line-numbers language-csharp" data-end="128" data-start="67" data-highlight="75"> private void button1_Click(object sender, RoutedEventArgs e) { DOMDocument document = browser.GetDocument(); //XPath expressions XPathResult resultNum = document.Evaluate("count(//div)"); XPathResult resultNumSpec = document.Evaluate("count(//div[@class='col-sm-4 prod-thumb'])"); XPathResult result = document.Evaluate("string( / html / body / div[2] / div[2] / div[1] / div[2] / div / div[1] / div[2] / h3 / a)"); XPathResult resultNodes = document.Evaluate("/ html / body / div[2] / div[2] / div[1] / div[2] / div / *"); //Check if XPath result type is correct if (resultNum.IsNumber && resultNumSpec.IsNumber) { label1.Content = "Quantity of all <div> = " + resultNum.Number; label2.Content = "Quantity of <div> with class 'col-sm-4 prod-thumb' = " + resultNumSpec.Number; } else { label1.Content = "Error"; label2.Content = "Error"; } //Check if XPath result type is correct if (result.IsString) { label3.Content = "Text from selected element: " + result.String; } else { label3.Content = "Error"; } //Check if XPath result type is correct if (resultNodes.IsIterator) { label4.Content = resultNodes.ResultType; } else { label4.Content = "Mistake"; } //Get list with DOMNodes var tmp = resultNodes.Iterator.Select(item => item.Node.Children); try { //Extract list with DOMNodes foreach (var item in tmp) { foreach (var item1 in item) { //Extract DOMNode from the list label4.Content = "Node type: " + item1.NodeType; label5.Content = "Node name: " + item1.NodeName; } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }</pre> </div> </figure> </div> <div class="example-item" id="0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec-539,,603,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #31</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_31" data-hash="0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec" data-area="539,,603,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '31')" class="rating-up btn btn-success" data-id="rating_31"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'31')" class="rating-down btn btn-danger" data-id="rating_31"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec-539,,603,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec&fullName=corefx-master%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FGlobalizationTests.cs&project=viniciussalmeida%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fviniciussalmeida%2Fcorefx%2Fblob%2Fmaster%2Fcorefx-master%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FGlobalizationTests.cs">GlobalizationTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fviniciussalmeida%2Fcorefx">viniciussalmeida/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="31"> <pre class="line-numbers language-csharp" data-end="603" data-start="540" data-highlight="545"> public static void GlobalizationTest5614() { var xml = "Single_byte_problem_chars_b.xml"; var testExpression = @"//V[contains(text(), ""öÜß"") or text()=""© ®"" or contains(text(), ""¿¾Õ"") or contains(text(), ""ÄäÖ§²³@µ"") or contains(text(), ""åE5å"") or contains(text(), ""™"")]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "öÜß" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "© ®" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "¿¾Õ" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "ÄäÖ§²³@µ" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "åE5å" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "™ ©­®" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xc7227d104eb4292e4d94eda060060380568698a5d585af49d0cc72fe1d55f815-534,,886,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #32</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_32" data-hash="0xc7227d104eb4292e4d94eda060060380568698a5d585af49d0cc72fe1d55f815" data-area="534,,886,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '32')" class="rating-up btn btn-success" data-id="rating_32"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'32')" class="rating-down btn btn-danger" data-id="rating_32"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xc7227d104eb4292e4d94eda060060380568698a5d585af49d0cc72fe1d55f815-534,,886,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xc7227d104eb4292e4d94eda060060380568698a5d585af49d0cc72fe1d55f815')">Show file</a> </div> <div class="example-project-info"> <nobr> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect"></a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="32"> <pre class="line-numbers language-csharp" data-end="886" data-start="535" data-highlight="539"> public static void AbbreviatedSyntaxTest1213() { var xml = "books.xml"; var testExpression = @"//*[1]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "bookstore", Name = "bookstore", HasNameTable = true, Value = "\n\t\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t\n\t\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t\n\t\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t\n\t\n\t\tRoad and Track\n\t\t3.50\n\t\t\n\t\tYes\n\t\n\t\n\t\tPC Week\n\t\tfree\n\t\tZiff Davis\n\t\n\t\n\t\tPC Magazine\n\t\t3.95\n\t\tZiff Davis\n\t\t\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t\n\t\n\t\n\t\tPC Magazine Best Product of 1997\n\t\n\t\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t\n\t\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t\n\t\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t\n\t\n\t\tTracking Trenton\n\t\t2.50\n\t\t\n\t\n\t\n\t\tTracking Trenton Stocks\n\t\t0.98\n\t\t\n\t\n\t\n\t\tTrenton Today, Trenton Tomorrow\n\t\t\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t\n\t\t6.50\n\t\t\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t\n\t\n\t\n\t\tWho's Who in Trenton\n\t\tRobert Bob\n\t\n\t\n\t\tWhere is Trenton?\n\t\n\t\n\t\tWhere in the world is Trenton?\n\t\n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "Seven Years in Trenton" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "first-name", Name = "first-name", HasNameTable = true, Value = "Joe" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "History of Trenton" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "first-name", Name = "first-name", HasNameTable = true, Value = "Mary" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "first-name", Name = "first-name", HasNameTable = true, Value = "JoeBob" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "XQL The Golden Years" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "first.name", Name = "first.name", HasNameTable = true, Value = "Mike" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "first.name", Name = "first.name", HasNameTable = true, Value = "Jonathan" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "Road and Track" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "PC Week" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "PC Magazine" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "story1", Name = "story1", HasNameTable = true, Value = "Create a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "details", Name = "details", HasNameTable = true, Value = "Create a list of needed hardware" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "details", Name = "details", HasNameTable = true, Value = "Can Netscape stay alive with Microsoft eating up its browser share?" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "articles", Name = "articles", HasNameTable = true, Value = "\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "story1", Name = "story1", HasNameTable = true, Value = "Sport Cars - Can you really dream?\n\t\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "award", Name = "award", HasNameTable = true, Value = "PC Magazine Best Product of 1997" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "History of Trenton 2" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "first.name", Name = "first.name", HasNameTable = true, Value = "Mary F" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "first.name", Name = "first.name", HasNameTable = true, Value = "Mary F" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "History of Trenton Vol 3" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "first-name", Name = "first-name", HasNameTable = true, Value = "Mary F" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "first-name", Name = "first-name", HasNameTable = true, Value = "Mary F" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "How To Fix Computers" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "first-name", Name = "first-name", HasNameTable = true, Value = "Hack" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "Tracking Trenton" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "Tracking Trenton Stocks" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "title", HasNameTable = true, Value = "Trenton Today, Trenton Tomorrow" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "first-name", Name = "first-name", HasNameTable = true, Value = "Toni" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "p", Name = "p", HasNameTable = true, Value = "It was a dark and stormy night." }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "emph", Name = "emph", HasNameTable = true, Value = "I" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "term", Name = "term", HasNameTable = true, Value = "Trenton" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "my:title", NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/", HasNameTable = true, Prefix = "my", Value = "Who's Who in Trenton" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "my:title", NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/", HasNameTable = true, Prefix = "my", Value = "Where is Trenton?" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "my:title", NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/", HasNameTable = true, Prefix = "my", Value = "Where in the world is Trenton?" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xf4a8bd963c32f8338b461beeff4f7ad1ebe073dc02bb5d4fb7e1366ce6e75138-199,,282,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #33</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_33" data-hash="0xf4a8bd963c32f8338b461beeff4f7ad1ebe073dc02bb5d4fb7e1366ce6e75138" data-area="199,,282,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '33')" class="rating-up btn btn-success" data-id="rating_33"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'33')" class="rating-down btn btn-danger" data-id="rating_33"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xf4a8bd963c32f8338b461beeff4f7ad1ebe073dc02bb5d4fb7e1366ce6e75138-199,,282,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xf4a8bd963c32f8338b461beeff4f7ad1ebe073dc02bb5d4fb7e1366ce6e75138&fullName=runtime-mjit%2Fsrc%2Flibraries%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FRegressionTestsTests.cs&project=z77ma%2Fruntime')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fz77ma%2Fruntime%2Fblob%2Fmaster%2Fruntime-mjit%2Fsrc%2Flibraries%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FRegressionTestsTests.cs">RegressionTestsTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fz77ma%2Fruntime">z77ma/runtime</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="33"> <pre class="line-numbers language-csharp" data-end="282" data-start="200" data-highlight="204"> public static void RegressionTestsTest5511() { var xml = "books.xml"; var testExpression = @"//book[starts-with(@stype,'')]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tTrenton Today, Trenton Tomorrow\n\t\t\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t\n\t\t6.50\n\t\t\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t\n\t" }); Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6-392,,465,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #34</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_34" data-hash="0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6" data-area="392,,465,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '34')" class="rating-up btn btn-success" data-id="rating_34"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'34')" class="rating-down btn btn-danger" data-id="rating_34"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6-392,,465,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6')">Show file</a> </div> <div class="example-project-info"> <nobr> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect"></a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="34"> <pre class="line-numbers language-csharp" data-end="465" data-start="393" data-highlight="398"> public static void GlobalizationTest5610() { var xml = "JPN_problem_chars_2.xml"; var testExpression = "//char[contains(., \"\u592A\u5E73\u6D0B\") or contains(., \"\u6BEB\u6B47\u6B49\") or contains(., \"\u6ECC\u6F3E\u9ED1\") or contains(., \"\u5341\u6B43\u6FEC\u85F9\u72BE\u8868\") or contains(., \"\u86DE\u6BEB\u70DF\u7930\u7AF9\") or contains(., \"\uFF41\uFF22\uFF41\") or contains(., \"\uFF90\uFF91\uFF92\")]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "char", Name = "char", HasNameTable = true, Value = "\nNon-Problem \u592A\u5E73\u6D0B\n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "char", Name = "char", HasNameTable = true, Value = "\nDOS Restricted \u6BEB\u6B47\u6B49\n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "char", Name = "char", HasNameTable = true, Value = "\nBoundary \u6ECC\u6F3E\u9ED1\n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "char", Name = "char", HasNameTable = true, Value = "\n5C Trail Byte \u5341\u6B43\u6FEC\u85F9\u72BE\u8868 \n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "char", Name = "char", HasNameTable = true, Value = "\n7C Trail Byte \u86DE\u6BEB\u70DF\u7930\u7AF9 \n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "char", Name = "char", HasNameTable = true, Value = "\nDB Romaji \uFF41\uFF22\uFF41 \n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "char", Name = "char", HasNameTable = true, Value = "\nKana \uFF90\uFF91\uFF92 \n" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xf4a8bd963c32f8338b461beeff4f7ad1ebe073dc02bb5d4fb7e1366ce6e75138-85,,154,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #35</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_35" data-hash="0xf4a8bd963c32f8338b461beeff4f7ad1ebe073dc02bb5d4fb7e1366ce6e75138" data-area="85,,154,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '35')" class="rating-up btn btn-success" data-id="rating_35"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'35')" class="rating-down btn btn-danger" data-id="rating_35"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xf4a8bd963c32f8338b461beeff4f7ad1ebe073dc02bb5d4fb7e1366ce6e75138-85,,154,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xf4a8bd963c32f8338b461beeff4f7ad1ebe073dc02bb5d4fb7e1366ce6e75138&fullName=runtime-mjit%2Fsrc%2Flibraries%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FRegressionTestsTests.cs&project=z77ma%2Fruntime')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fz77ma%2Fruntime%2Fblob%2Fmaster%2Fruntime-mjit%2Fsrc%2Flibraries%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FRegressionTestsTests.cs">RegressionTestsTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fz77ma%2Fruntime">z77ma/runtime</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="35"> <pre class="line-numbers language-csharp" data-end="154" data-start="86" data-highlight="90"> public static void RegressionTestsTest557() { var xml = "t98598.xml"; var testExpression = @"//namespace::*"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Namespace, LocalName = "xml", Name = "xml", HasNameTable = true, Value = "http://www.w3.org/XML/1998/namespace" }, new XPathResultToken { NodeType = XPathNodeType.Namespace, LocalName = "foo2", Name = "foo2", HasNameTable = true, Value = "f2" }, new XPathResultToken { NodeType = XPathNodeType.Namespace, LocalName = "foo1", Name = "foo1", HasNameTable = true, Value = "f1" }, new XPathResultToken { NodeType = XPathNodeType.Namespace, HasNameTable = true, Value = "f0" }, new XPathResultToken { NodeType = XPathNodeType.Namespace, LocalName = "xml", Name = "xml", HasNameTable = true, Value = "http://www.w3.org/XML/1998/namespace" }, new XPathResultToken { NodeType = XPathNodeType.Namespace, LocalName = "bar2", Name = "bar2", HasNameTable = true, Value = "b2" }, new XPathResultToken { NodeType = XPathNodeType.Namespace, LocalName = "bar1", Name = "bar1", HasNameTable = true, Value = "b1" }, new XPathResultToken { NodeType = XPathNodeType.Namespace, HasNameTable = true, Value = "b0" }, new XPathResultToken { NodeType = XPathNodeType.Namespace, LocalName = "xml", Name = "xml", HasNameTable = true, Value = "http://www.w3.org/XML/1998/namespace" }); Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec-390,,463,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #36</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_36" data-hash="0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec" data-area="390,,463,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '36')" class="rating-up btn btn-success" data-id="rating_36"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'36')" class="rating-down btn btn-danger" data-id="rating_36"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec-390,,463,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x98e6acdf6d1362a9a99a575d0da5d889b20d44c16c846f002012892df82b59ec&fullName=corefx-master%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FGlobalizationTests.cs&project=viniciussalmeida%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fviniciussalmeida%2Fcorefx%2Fblob%2Fmaster%2Fcorefx-master%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FGlobalizationTests.cs">GlobalizationTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fviniciussalmeida%2Fcorefx">viniciussalmeida/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="36"> <pre class="line-numbers language-csharp" data-end="463" data-start="391" data-highlight="396"> public static void GlobalizationTest5610() { var xml = "JPN_problem_chars_2.xml"; var testExpression = @"//char[contains(., ""太平洋"") or contains(., ""毫歇歉"") or contains(., ""滌漾黑"") or contains(., ""十歃濬藹犾表"") or contains(., ""蛞毫烟礰竹"") or contains(., ""aBa"") or contains(., ""ミムメ"")]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "char", Name = "char", HasNameTable = true, Value = "\nNon-Problem 太平洋\n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "char", Name = "char", HasNameTable = true, Value = "\nDOS Restricted 毫歇歉\n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "char", Name = "char", HasNameTable = true, Value = "\nBoundary 滌漾黑\n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "char", Name = "char", HasNameTable = true, Value = "\n5C Trail Byte 十歃濬藹犾表 \n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "char", Name = "char", HasNameTable = true, Value = "\n7C Trail Byte 蛞毫烟礰竹 \n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "char", Name = "char", HasNameTable = true, Value = "\nDB Romaji aBa \n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "char", Name = "char", HasNameTable = true, Value = "\nKana ミムメ \n" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-5618,,5692,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #37</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_37" data-hash="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f" data-area="5618,,5692,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '37')" class="rating-up btn btn-success" data-id="rating_37"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'37')" class="rating-down btn btn-danger" data-id="rating_37"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-5618,,5692,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs">PathPredicatePositionTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="37"> <pre class="line-numbers language-csharp" data-end="5692" data-start="5619" data-highlight="5623"> public static void UsingPositionFunctionTest687() { var xml = "books.xml"; var testExpression = @"//book/preceding-sibling::*[position()=1][position()=last()][1]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tPC Magazine Best Product of 1997\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "my:magazine", NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/", HasNameTable = true, Prefix = "my", Value = "\n\t\tTracking Trenton Stocks\n\t\t0.98\n\t\t\n\t" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xbc798675388e9d55c6781f3916d1a40ae69bb14901efb42a1fe9705287709885-204,,274,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #38</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_38" data-hash="0xbc798675388e9d55c6781f3916d1a40ae69bb14901efb42a1fe9705287709885" data-area="204,,274,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '38')" class="rating-up btn btn-success" data-id="rating_38"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'38')" class="rating-down btn btn-danger" data-id="rating_38"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xbc798675388e9d55c6781f3916d1a40ae69bb14901efb42a1fe9705287709885-204,,274,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xbc798675388e9d55c6781f3916d1a40ae69bb14901efb42a1fe9705287709885&fullName=dotnet-corefx-master%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FStepsTests.cs&project=wuyou201400%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fwuyou201400%2Fcorefx%2Fblob%2Fmaster%2Fdotnet-corefx-master%2Fsrc%2FCommon%2Ftests%2FSystem.Xml.XPath%2FStepsTests.cs">StepsTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fwuyou201400%2Fcorefx">wuyou201400/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="38"> <pre class="line-numbers language-csharp" data-end="274" data-start="205" data-highlight="209"> public static void StepsTest149() { var xml = "books.xml"; var testExpression = @"/bookstore/* [name()='book' or name()='magazine'][name()='magazine']"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tRoad and Track\n\t\t3.50\n\t\t\n\t\tYes\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tPC Week\n\t\tfree\n\t\tZiff Davis\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tPC Magazine\n\t\t3.95\n\t\tZiff Davis\n\t\t\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\t\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tPC Magazine Best Product of 1997\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tTracking Trenton\n\t\t2.50\n\t\t\n\t" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-4896,,4980,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #39</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_39" data-hash="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f" data-area="4896,,4980,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '39')" class="rating-up btn btn-success" data-id="rating_39"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'39')" class="rating-down btn btn-danger" data-id="rating_39"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-4896,,4980,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs">PathPredicatePositionTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="39"> <pre class="line-numbers language-csharp" data-end="4980" data-start="4897" data-highlight="4901"> public static void UsingPositionFunctionTest681() { var xml = "books.xml"; var testExpression = @"//book/namespace::*/parent::*[position()=1][position()=last()][1]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tTrenton Today, Trenton Tomorrow\n\t\t\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t\n\t\t6.50\n\t\t\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t\n\t" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-681,,690,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #40</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_40" data-hash="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f" data-area="681,,690,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '40')" class="rating-up btn btn-success" data-id="rating_40"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'40')" class="rating-down btn btn-danger" data-id="rating_40"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-681,,690,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs">PathPredicatePositionTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="40"> <pre class="line-numbers language-csharp" data-end="690" data-start="682" data-highlight="687"> public static void UsingPositionFunctionTest623() { var xml = "books.xml"; var startingNodePath = "/bookstore/book/author"; var testExpression = @"self::node()[position()>1 or position()<1]"; var expected = new XPathResult(0); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div class="example-item" id="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-4986,,5341,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #41</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_41" data-hash="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f" data-area="4986,,5341,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '41')" class="rating-up btn btn-success" data-id="rating_41"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'41')" class="rating-down btn btn-danger" data-id="rating_41"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-4986,,5341,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs">PathPredicatePositionTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="41"> <pre class="line-numbers language-csharp" data-end="5341" data-start="4987" data-highlight="4991"> public static void UsingPositionFunctionTest682() { var xml = "books.xml"; var testExpression = @"//book/following::*/parent::*[position()=1][position()=last()][1]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "bookstore", Name = "bookstore", HasNameTable = true, Value = "\n\t\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t\n\t\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t\n\t\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t\n\t\n\t\tRoad and Track\n\t\t3.50\n\t\t\n\t\tYes\n\t\n\t\n\t\tPC Week\n\t\tfree\n\t\tZiff Davis\n\t\n\t\n\t\tPC Magazine\n\t\t3.95\n\t\tZiff Davis\n\t\t\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t\n\t\n\t\n\t\tPC Magazine Best Product of 1997\n\t\n\t\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t\n\t\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t\n\t\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t\n\t\n\t\tTracking Trenton\n\t\t2.50\n\t\t\n\t\n\t\n\t\tTracking Trenton Stocks\n\t\t0.98\n\t\t\n\t\n\t\n\t\tTrenton Today, Trenton Tomorrow\n\t\t\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t\n\t\t6.50\n\t\t\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t\n\t\n\t\n\t\tWho's Who in Trenton\n\t\tRobert Bob\n\t\n\t\n\t\tWhere is Trenton?\n\t\n\t\n\t\tWhere in the world is Trenton?\n\t\n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "author", Name = "author", HasNameTable = true, Value = "\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "publication", Name = "publication", HasNameTable = true, Value = "\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "author", Name = "author", HasNameTable = true, Value = "\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "publication", Name = "publication", HasNameTable = true, Value = "\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tRoad and Track\n\t\t3.50\n\t\t\n\t\tYes\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tPC Week\n\t\tfree\n\t\tZiff Davis\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tPC Magazine\n\t\t3.95\n\t\tZiff Davis\n\t\t\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "articles", Name = "articles", HasNameTable = true, Value = "\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "story1", Name = "story1", HasNameTable = true, Value = "Create a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "story2", Name = "story2", HasNameTable = true, Value = "The future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\t\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "articles", Name = "articles", HasNameTable = true, Value = "\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tPC Magazine Best Product of 1997\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "author", Name = "author", HasNameTable = true, Value = "\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "publication", Name = "publication", HasNameTable = true, Value = "\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "author", Name = "author", HasNameTable = true, Value = "\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "publication", Name = "publication", HasNameTable = true, Value = "\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "author", Name = "author", HasNameTable = true, Value = "\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tTracking Trenton\n\t\t2.50\n\t\t\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "my:magazine", NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/", HasNameTable = true, Prefix = "my", Value = "\n\t\tTracking Trenton Stocks\n\t\t0.98\n\t\t\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tTrenton Today, Trenton Tomorrow\n\t\t\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t\n\t\t6.50\n\t\t\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "author", Name = "author", HasNameTable = true, Value = "\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "excerpt", Name = "excerpt", HasNameTable = true, Value = "\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "p", Name = "p", HasNameTable = true, Value = "But then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "definition-list", Name = "definition-list", HasNameTable = true, Value = "\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "my:book", NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/", HasNameTable = true, Prefix = "my", Value = "\n\t\tWho's Who in Trenton\n\t\tRobert Bob\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "my:book", NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/", HasNameTable = true, Prefix = "my", Value = "\n\t\tWhere is Trenton?\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "my:book", NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/", HasNameTable = true, Prefix = "my", Value = "\n\t\tWhere in the world is Trenton?\n\t" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-776,,948,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #42</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_42" data-hash="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f" data-area="776,,948,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '42')" class="rating-up btn btn-success" data-id="rating_42"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'42')" class="rating-down btn btn-danger" data-id="rating_42"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-776,,948,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs">PathPredicatePositionTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="42"> <pre class="line-numbers language-csharp" data-end="948" data-start="777" data-highlight="782"> public static void UsingPositionFunctionTest627() { var xml = "books.xml"; var startingNodePath = "/bookstore"; var testExpression = @"child::*/child::*[position()=last()]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "price", Name = "price", HasNameTable = true, Value = "12" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "price", Name = "price", HasNameTable = true, Value = "55" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "price", Name = "price", HasNameTable = true, Value = "55.95" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "special_edition", Name = "special_edition", HasNameTable = true, Value = "Yes" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "publisher", Name = "publisher", HasNameTable = true, Value = "Ziff Davis" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "articles", Name = "articles", HasNameTable = true, Value = "\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "articles", Name = "articles", HasNameTable = true, Value = "\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "award", Name = "award", HasNameTable = true, Value = "PC Magazine Best Product of 1997" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "price", Name = "price", HasNameTable = true, Value = "55" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "price", Name = "price", HasNameTable = true, Value = "10" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "price", Name = "price", HasNameTable = true, Value = "08" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "subscription", Name = "subscription", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "subscription", Name = "subscription", HasNameTable = true }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "excerpt", Name = "excerpt", HasNameTable = true, Value = "\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "author", Name = "my:author", NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/", HasNameTable = true, Prefix = "my", Value = "Robert Bob" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "my:title", NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/", HasNameTable = true, Prefix = "my", Value = "Where is Trenton?" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "my:title", NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/", HasNameTable = true, Prefix = "my", Value = "Where in the world is Trenton?" }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div class="example-item" id="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-5550,,5612,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #43</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_43" data-hash="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f" data-area="5550,,5612,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '43')" class="rating-up btn btn-success" data-id="rating_43"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'43')" class="rating-down btn btn-danger" data-id="rating_43"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-5550,,5612,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs">PathPredicatePositionTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="43"> <pre class="line-numbers language-csharp" data-end="5612" data-start="5551" data-highlight="5555"> public static void UsingPositionFunctionTest686() { var xml = "books.xml"; var testExpression = @"//book/preceding::*[position()=1][position()=last()][1]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "price", Name = "price", HasNameTable = true, Value = "12" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "price", Name = "price", HasNameTable = true, Value = "55" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "award", Name = "award", HasNameTable = true, Value = "PC Magazine Best Product of 1997" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "price", Name = "price", HasNameTable = true, Value = "55" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "price", Name = "price", HasNameTable = true, Value = "10" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasAttributes = true, IsEmptyElement = true, LocalName = "subscription", Name = "subscription", HasNameTable = true }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6-471,,535,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #44</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_44" data-hash="0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6" data-area="471,,535,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '44')" class="rating-up btn btn-success" data-id="rating_44"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'44')" class="rating-down btn btn-danger" data-id="rating_44"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6-471,,535,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0x7468a0a97f3f24e69af9e93b3fca01ac2eccdd63f8e1cc43d7a07985aeded6d6')">Show file</a> </div> <div class="example-project-info"> <nobr> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect"></a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="44"> <pre class="line-numbers language-csharp" data-end="535" data-start="472" data-highlight="477"> public static void GlobalizationTest5613() { var xml = "KOR_problem_chars_b.xml"; var testExpression = "root/V[contains(text(), \"\uD55C\uAE00\") or text()=\"\u306F\uAF9C\u306F\uAF9C\u306F\uAF9C\u306F\uAF9C\u306F\uAF9C\" or contains(text(), \"\u8A70\u8A70\") or contains(text(), \"\u6A8D\u4E5F\") or contains(text(), \"\uAC00\uB098 \uAC00\") or contains(text(), \"\uFF2A\uFF55\uFF4E\uFF4A\uFF41\")]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "\uD55C\uAE00" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "\u306F\uAF9C\u306F\uAF9C\u306F\uAF9C\u306F\uAF9C\u306F\uAF9C" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "\u8A70\u8A70\u8A70\u8A70" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "\u8A00\u6A8D\u4E5F\u8A00\u6A8D\u4E5F\u8A00\u6A8D\u4E5F" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "\uAC00\uB098 \uAC00\uB098 \uAC00\uB098 \uAC00\uB098 \uAC00\uB098 \uAC00\uB098" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "V", Name = "V", HasNameTable = true, Value = "\uFF2A\uFF55\uFF4E\uFF4A\uFF41" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-574,,631,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #45</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_45" data-hash="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f" data-area="574,,631,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '45')" class="rating-up btn btn-success" data-id="rating_45"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'45')" class="rating-down btn btn-danger" data-id="rating_45"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-574,,631,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs">PathPredicatePositionTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="45"> <pre class="line-numbers language-csharp" data-end="631" data-start="575" data-highlight="580"> public static void UsingPositionFunctionTest620() { var xml = "books.xml"; var startingNodePath = "/bookstore"; var testExpression = @"magazine/attribute::*[position()=1 or position()=2][position()=last()]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "frequency", Name = "frequency", HasNameTable = true, Value = "monthly" }, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "frequency", Name = "frequency", HasNameTable = true, Value = "weekly" }, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "frequency", Name = "frequency", HasNameTable = true, Value = "bi-monthly" }, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "frequency", Name = "frequency", HasNameTable = true, Value = "monthly" }, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "frequency", Name = "frequency", HasNameTable = true, Value = "monthly" }, new XPathResultToken { NodeType = XPathNodeType.Attribute, LocalName = "frequency", Name = "frequency", HasNameTable = true, Value = "monthly" }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div class="example-item" id="0xce5d7c0ec031d7aa4382600094615bcaf66d4877e0739abb216d3e254f86c5c0-597,,600,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #46</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_46" data-hash="0xce5d7c0ec031d7aa4382600094615bcaf66d4877e0739abb216d3e254f86c5c0" data-area="597,,600,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '46')" class="rating-up btn btn-success" data-id="rating_46"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'46')" class="rating-down btn btn-danger" data-id="rating_46"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xce5d7c0ec031d7aa4382600094615bcaf66d4877e0739abb216d3e254f86c5c0-597,,600,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xce5d7c0ec031d7aa4382600094615bcaf66d4877e0739abb216d3e254f86c5c0&fullName=SaltarelleWeb-master%2FWeb%2FGenerated%2FDocument.cs&project=softearth%2FSaltarelleWeb')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fsoftearth%2FSaltarelleWeb%2Fblob%2Fmaster%2FSaltarelleWeb-master%2FWeb%2FGenerated%2FDocument.cs">Document.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2Fsoftearth%2FSaltarelleWeb">softearth/SaltarelleWeb</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="46"> <pre class="line-numbers language-csharp" data-end="600" data-start="598" data-highlight="598"> public static XPathResult Evaluate(string expression, XmlNode contextNode, XPathNSResolver resolver, ushort type, XPathResult result) { return(default(XPathResult)); }</pre> </div> </figure> </div> <div class="example-item" id="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-749,,769,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #47</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_47" data-hash="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f" data-area="749,,769,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '47')" class="rating-up btn btn-success" data-id="rating_47"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'47')" class="rating-down btn btn-danger" data-id="rating_47"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-749,,769,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs">PathPredicatePositionTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="47"> <pre class="line-numbers language-csharp" data-end="769" data-start="750" data-highlight="755"> public static void UsingPositionFunctionTest626() { var xml = "books.xml"; var startingNodePath = "/bookstore"; var testExpression = @"(child::*/child::*)[position()=last()]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "title", Name = "my:title", NamespaceURI = "urn:http//www.placeholder-name-here.com/schema/", HasNameTable = true, Prefix = "my", Value = "Where in the world is Trenton?" }); ; Utils.XPathNodesetTest(xml, testExpression, expected, startingNodePath: startingNodePath); }</pre> </div> </figure> </div> <div class="example-item" id="0xd409335ce96aa24f18bf9a3338d19a7daa10c3f2d9db18bd78ed8e3018796653-21,,167,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #48</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_48" data-hash="0xd409335ce96aa24f18bf9a3338d19a7daa10c3f2d9db18bd78ed8e3018796653" data-area="21,,167,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '48')" class="rating-up btn btn-success" data-id="rating_48"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'48')" class="rating-down btn btn-danger" data-id="rating_48"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xd409335ce96aa24f18bf9a3338d19a7daa10c3f2d9db18bd78ed8e3018796653-21,,167,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xd409335ce96aa24f18bf9a3338d19a7daa10c3f2d9db18bd78ed8e3018796653')">Show file</a> </div> <div class="example-project-info"> <nobr> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect"></a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="48"> <pre class="line-numbers language-csharp" data-end="167" data-start="22" data-highlight="26"> public static void NodeSetsTest511() { var xml = "books.xml"; var testExpression = @"/bookstore/book | /bookstore/magazine"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tSeven Years in Trenton\n\t\t\n\t\t\tJoe\n\t\t\tBob\n\t\t\tTrenton Literary Review Honorable Mention\n\t\t\tUSA\n\t\t\n\t\t12\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton\n\t\t\n\t\t\tMary\n\t\t\tBob\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tJoeBob\n\t\t\t\tLoser\n\t\t\t\tUS\n\t\t\t\n\t\t\n\t\t55\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tXQL The Golden Years\n\t\t\n\t\t\tMike\n\t\t\tHyman\n\t\t\t\n\t\t\t\tXQL For Dummies\n\t\t\t\tJonathan\n\t\t\t\tMarsh\n\t\t\t\n\t\t\n\t\t55.95\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tRoad and Track\n\t\t3.50\n\t\t\n\t\tYes\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tPC Week\n\t\tfree\n\t\tZiff Davis\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tPC Magazine\n\t\t3.95\n\t\tZiff Davis\n\t\t\n\t\t\tCreate a dream PC\n\t\t\t\tCreate a list of needed hardware\n\t\t\t\n\t\t\tThe future of the web\n\t\t\t\tCan Netscape stay alive with Microsoft eating up its browser share?\n\t\t\t\tMSFT 99.30\n\t\t\t\t1998-06-23\n\t\t\t\n\t\t\tVisual Basic 5.0 - Will it stand the test of time?\n\t\t\t\n\t\t\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\t\n\t\t\tSport Cars - Can you really dream?\n\t\t\t\n\t\t\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tPC Magazine Best Product of 1997\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton 2\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t55\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHistory of Trenton Vol 3\n\t\t\n\t\t\tMary F\n\t\t\tRobinson\n\t\t\tFrank\n\t\t\tAnderson\n\t\t\tPulizer\n\t\t\t\n\t\t\t\tSelected Short Stories of\n\t\t\t\tMary F\n\t\t\t\tRobinson\n\t\t\t\n\t\t\n\t\t10\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tHow To Fix Computers\n\t\t\n\t\t\tHack\n\t\t\ter\n\t\t\tPh.D.\n\t\t\n\t\t08\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "magazine", Name = "magazine", HasNameTable = true, Value = "\n\t\tTracking Trenton\n\t\t2.50\n\t\t\n\t" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, HasAttributes = true, LocalName = "book", Name = "book", HasNameTable = true, Value = "\n\t\tTrenton Today, Trenton Tomorrow\n\t\t\n\t\t\tToni\n\t\t\tBob\n\t\t\tB.A.\n\t\t\tPh.D.\n\t\t\tPulizer\n\t\t\tStill in Trenton\n\t\t\tTrenton Forever\n\t\t\n\t\t6.50\n\t\t\n\t\t\tIt was a dark and stormy night.\n\t\t\tBut then all nights in Trenton seem dark and\n\t\t\tstormy to someone who has gone through what\n\t\t\tI have.\n\t\t\t\n\t\t\t\n\t\t\t\tTrenton\n\t\t\t\tmisery\n\t\t\t\n\t\t\n\t" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-955,,1098,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #49</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_49" data-hash="0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f" data-area="955,,1098,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '49')" class="rating-up btn btn-success" data-id="rating_49"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'49')" class="rating-down btn btn-danger" data-id="rating_49"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f-955,,1098,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xfff74e8ab013784d5954afa9cba61482acc60710a6ed79071fe909a3746b313f&fullName=src%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs&project=ChuangYang%2Fcorefx')">Show file</a> </div> <div class="example-project-info"> <nobr> <span>File:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx%2Fblob%2Fmaster%2Fsrc%2FCommon%2Ftests%2FSystem%2FXml%2FXPath%2FPathPredicatePositionTests.cs">PathPredicatePositionTests.cs</a> </nobr> <nobr> <span>Project:</span> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect?url=https%3A%2F%2Fgithub.com%2FChuangYang%2Fcorefx">ChuangYang/corefx</a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="49"> <pre class="line-numbers language-csharp" data-end="1098" data-start="956" data-highlight="960"> public static void UsingPositionFunctionTest628() { var xml = "numbers.xml"; var testExpression = @"//*[position()=//n]"; var expected = new XPathResult(0, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "mydoc", Name = "mydoc", HasNameTable = true, Value = "\n\n\t1\n\t2\n\t3\n\n\n\t1\n\t1\n\t2\n\t2\n\t3\n\t4\n\n\n\t5\n\tNaN\n\t0\n\n\n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "numbers", Name = "numbers", HasNameTable = true, Value = "\n\t1\n\t2\n\t3\n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "n", Name = "n", HasNameTable = true, Value = "1" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "n", Name = "n", HasNameTable = true, Value = "2" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "n", Name = "n", HasNameTable = true, Value = "3" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "numbers", Name = "numbers", HasNameTable = true, Value = "\n\t1\n\t1\n\t2\n\t2\n\t3\n\t4\n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "n", Name = "n", HasNameTable = true, Value = "1" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "n", Name = "n", HasNameTable = true, Value = "1" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "n", Name = "n", HasNameTable = true, Value = "2" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "n", Name = "n", HasNameTable = true, Value = "2" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "n", Name = "n", HasNameTable = true, Value = "3" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "numbers", Name = "numbers", HasNameTable = true, Value = "\n\t5\n\tNaN\n\t0\n" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "n", Name = "n", HasNameTable = true, Value = "5" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "n", Name = "n", HasNameTable = true, Value = "NaN" }, new XPathResultToken { NodeType = XPathNodeType.Element, HasChildren = true, LocalName = "n", Name = "n", HasNameTable = true, Value = "0" }); ; Utils.XPathNodesetTest(xml, testExpression, expected); }</pre> </div> </figure> </div> <div class="example-item" id="0xd8142d49a41c667d5858616fd35597de10178f1db3abb03801519a6c83c647ee-13,,80,"> <div class="bs-example"> <div> <div class="bs-example-title">Example #50</div> <div style="position: absolute;right: 15px;top: 10px;" id="rating_50" data-hash="0xd8142d49a41c667d5858616fd35597de10178f1db3abb03801519a6c83c647ee" data-area="13,,80,"> <div class="rating-amount">0</div> <a title="Mark this example as good" href="javascript:app.addRating(1, '50')" class="rating-up btn btn-success" data-id="rating_50"><i class="icon-button icon-thumbs-up"></i></a> <a title="Mark this example as bad" href="javascript:app.addRating(-1,'50')" class="rating-down btn btn-danger" data-id="rating_50"><i class="icon-button icon-thumbs-down"></i></a> </div> </div> <div style="display:flex;align-items: center;flex-wrap: wrap"> <div style="display: inline-block;margin-right: 10px"> <a class="btn btn-default" title="Direct link to this example" href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html#0xd8142d49a41c667d5858616fd35597de10178f1db3abb03801519a6c83c647ee-13,,80,"><i class="icon-button icon-link"></i></a> <a rel="nofollow" class="btn btn-default" href="javascript:app.open('https://csharp.hotexamples.com/site/file?hash=0xd8142d49a41c667d5858616fd35597de10178f1db3abb03801519a6c83c647ee')">Show file</a> </div> <div class="example-project-info"> <nobr> <a target="_blank" rel="nofollow" href="https://csharp.hotexamples.com/site/redirect"></a> </nobr> </div> </div> </div> <figure class="highlight"> <div class="example" data-id="50"> <pre class="line-numbers language-csharp" data-end="80" data-start="14" data-highlight="29"> static void Main(string[] args) { // The XPathMessageQueryCollection inherits from MessageQueryCollection. XPathMessageQueryCollection queryCollection = MessageHelper.SetupQueryCollection(); // Create a message and a copy of the message. You must create a buffered copy to access the message body. Message mess = MessageHelper.CreateMessage(); MessageBuffer mb = mess.CreateBufferedCopy(int.MaxValue); // Evaluate every query in the collection. foreach (XPathMessageQuery q in queryCollection) { // Evaluate the query. Note the result type is an XPathResult. XPathResult qPathResult = q.Evaluate <XPathResult>(mb); // Use the XPathResult to determine the result type. Console.WriteLine("Result type: {0}", qPathResult.ResultType); // The following code prints the result according to the result type. if (qPathResult.ResultType == XPathResultType.String) { Console.WriteLine("{0} = {1}", q.Expression, qPathResult.GetResultAsString()); } if (qPathResult.ResultType == XPathResultType.NodeSet) { // Iterate through the node set. XPathNodeIterator ns = qPathResult.GetResultAsNodeset(); foreach (XPathNavigator n in ns) { Console.WriteLine("\t{0} = {1}", q.Expression, n.Value); } } if (qPathResult.ResultType == XPathResultType.Number) { Console.WriteLine("\t{0} = {1}", q.Expression, qPathResult.GetResultAsNumber()); } if (qPathResult.ResultType == XPathResultType.Boolean) { Console.WriteLine("\t{0} ={1}", q.Expression, qPathResult.GetResultAsBoolean()); } if (qPathResult.ResultType == XPathResultType.Error) { Console.WriteLine("\tError!"); } } Console.WriteLine(); // The alternate code below demonstrates similar funcionality using a MessageQueryTable. // The difference is the KeyValuePair that requires a key to index each value. // The code uses the expression as the key, and an arbitrary value for the value. //MessageQueryTable<string> mq = MessageHelper.SetupTable(); //foreach (KeyValuePair<MessageQuery, string> kv in mq) //{ // XPathMessageQuery xp = (XPathMessageQuery)kv.Key; // Console.WriteLine("Value = {0}", kv.Value); // Console.WriteLine("{0} = {1}", xp.Expression, xp.Evaluate<string>(mb)); //} Console.ReadLine(); }</pre> </div> </figure> </div> <div id="all-examples"></div> </div> </div> </div> <div class="page-side-banner hidden-xs hidden-sm hidden-md" style="width:300px"> <div id="ezoic-pub-ad-placeholder-131"> <div class="fx" style="width:300px"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- right-sidebar-fx --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3697522372581514" data-ad-slot="8968655429" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> </div> </div> </div> <footer class="footer"> <div class="container"> <div class="row"> <div class="col-md-12" style="text-align: center"> <a href="https://csharp.hotexamples.com/site/trends?type=csharp%7Cc"> Top Classes </a> | <a href="https://csharpdoc.hotexamples.com/doc/map">Documentation</a> | <a href="/site/privacy">Privacy Policy</a> | <a href="https://cpp.hotexamples.com/direct-sales.html">Advertise with us</a> </div> </div> <div class="row"> <div class="col-md-12" style="text-align: center"> <a href="https://hotexamples.com/">PHP</a> | <a href="https://csharp.hotexamples.com/">C# (CSharp)</a> | <a href="https://java.hotexamples.com/">Java</a> | <a href="https://golang.hotexamples.com/">Golang</a> | <a href="https://cpp.hotexamples.com/">C++ (Cpp)</a> | <a href="https://python.hotexamples.com/">Python</a> | <a href="https://javascript.hotexamples.com/">JavaScript</a> | <a href="https://typescript.hotexamples.com/">TypeScript</a> </div> </div> <div class="row"> <div class="col-md-12" style="text-align: center"> <a href="https://csharp.hotexamples.com/examples/-/XPathResult/-/php-xpathresult-class-examples.html">EN</a> | <a href="https://csharp.hotexamples.com/ru/examples/-/XPathResult/-/php-xpathresult-class-examples.html">RU</a> | <a href="https://csharp.hotexamples.com/de/examples/-/XPathResult/-/php-xpathresult-class-examples.html">DE</a> | <a href="https://csharp.hotexamples.com/fr/examples/-/XPathResult/-/php-xpathresult-class-examples.html">FR</a> | <a href="https://csharp.hotexamples.com/es/examples/-/XPathResult/-/php-xpathresult-class-examples.html">ES</a> | <a href="https://csharp.hotexamples.com/pt/examples/-/XPathResult/-/php-xpathresult-class-examples.html">PT</a> | <a href="https://csharp.hotexamples.com/it/examples/-/XPathResult/-/php-xpathresult-class-examples.html">IT</a> | <a href="https://csharp.hotexamples.com/jp/examples/-/XPathResult/-/php-xpathresult-class-examples.html">JP</a> | <a href="https://csharp.hotexamples.com/zh/examples/-/XPathResult/-/php-xpathresult-class-examples.html">ZH</a> | <a href="https://csharp.hotexamples.com/ko/examples/-/XPathResult/-/php-xpathresult-class-examples.html">KO</a> </div> </div> <div class="row"> <div class="col-md-10 col-md-offset-1"> </div> <div class="col-md-1"> <!--LiveInternet counter--> <script type="text/javascript"><!-- document.write("<a href='//www.liveinternet.ru/click' " + "target=_blank><img src='//counter.yadro.ru/hit?t44.6;r" + escape(document.referrer) + ((typeof (screen) == "undefined") ? "" : ";s" + screen.width + "*" + screen.height + "*" + (screen.colorDepth ? screen.colorDepth : screen.pixelDepth)) + ";u" + escape(document.URL) + ";" + Math.random() + "' alt='' title='LiveInternet' " + "border='0' width='31' height='31'><\/a>"); //--></script><!--/LiveInternet--> </div> </div> </div> </footer> <script src="//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="/assets/30dd86a6f06b64184847037c52c63e07aa3c9a26.js"></script> <script>jQuery(function ($) { jQuery('#search-form').yiiActiveForm([{"id":"searchform-lang","name":"lang","container":".field-searchform-lang","input":"#searchform-lang","enableAjaxValidation":true},{"id":"searchform-search","name":"search","container":".field-searchform-search","input":"#searchform-search","enableAjaxValidation":true,"validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"Search cannot be blank."});}}], []); });</script></body> </html>