本文整理汇总了C#中XPathResult类的典型用法代码示例。如果您正苦于以下问题:C# XPathResult类的具体用法?C# XPathResult怎么用?C# XPathResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XPathResult类属于命名空间,在下文中一共展示了XPathResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: UsingPositionFunctionTest62
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);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:30,代码来源:PathPredicatePositionTests.cs
示例2: Copy
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.");
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:XPathResult.cs
示例3: AbbreviatedSyntaxTest125
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);
}
开发者ID:svcgany1,项目名称:corefx,代码行数:10,代码来源:MiscWithEncodings.cs
示例4: AxesTest11
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);
}
开发者ID:noahfalk,项目名称:corefx,代码行数:53,代码来源:PathAxesTests.cs
示例5: NodeTestsTest82
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);
}
开发者ID:noahfalk,项目名称:corefx,代码行数:12,代码来源:PathNodeTests.cs
示例6: ComplexExpressionsTest31
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);
}
开发者ID:nandhanurrevanth,项目名称:corefx,代码行数:18,代码来源:PathAxeComplexExprTests.cs
示例7: NodeSetFunctionsTest223
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);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:18,代码来源:NodeSetFunctionsTests.cs
示例8: MatchesTest234
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);
}
开发者ID:noahfalk,项目名称:corefx,代码行数:18,代码来源:NodeSetMatchesTests.cs
示例9: GlobalizationTest5612
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);
}
开发者ID:svcgany1,项目名称:corefx,代码行数:19,代码来源:MiscWithEncodings.cs
示例10: BasicsTest162
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);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:19,代码来源:BasicsTests.cs
示例11: BasicsTest161
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);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:19,代码来源:BasicsTests.cs
示例12: NodeSetFunctionsTest222
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);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:19,代码来源:NodeSetFunctionsTests.cs
示例13: CustomerScenariosTest302
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);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:19,代码来源:CustomerScenariosTests.cs
示例14: PredicatesTest102
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);
}
开发者ID:noahfalk,项目名称:corefx,代码行数:20,代码来源:PathPredicatesTests.cs
示例15: LexicalStructureTest521
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);
}
开发者ID:noahfalk,项目名称:corefx,代码行数:20,代码来源:LexicalStructureTests.cs
示例16: UsingPositionFunctionTest61
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);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:21,代码来源:PathPredicatePositionTests.cs
示例17: NodeTestsTest81
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);
}
开发者ID:noahfalk,项目名称:corefx,代码行数:40,代码来源:PathNodeTests.cs
示例18: NodeSetsTest181
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);
}
开发者ID:noahfalk,项目名称:corefx,代码行数:38,代码来源:NodeSetsTests.cs
示例19: MiscellaneousCasesTest531
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);
}
开发者ID:svcgany1,项目名称:corefx,代码行数:36,代码来源:MiscellaneousCasesTests.cs
示例20: SetContextFunctionalTestsTest432
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);
}
开发者ID:noahfalk,项目名称:corefx,代码行数:24,代码来源:SetContextFunctionalTests.cs
注:本文中的XPathResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论