1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
//------------------------------------------------------------------------------
// <copyright file="XPathExpr.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// <owner current="true" primary="true">[....]</owner>
//------------------------------------------------------------------------------
namespace System.Xml.XPath {
using System;
using System.Xml;
using System.Collections;
using MS.Internal.Xml.XPath;
public enum XmlSortOrder {
Ascending = 1,
Descending = 2,
}
public enum XmlCaseOrder {
None = 0,
UpperFirst = 1,
LowerFirst = 2,
}
public enum XmlDataType {
Text = 1,
Number = 2,
}
public enum XPathResultType {
Number = 0 ,
String = 1,
Boolean = 2,
NodeSet = 3,
Navigator = XPathResultType.String,
Any = 5,
Error
};
public abstract class XPathExpression {
internal XPathExpression(){}
public abstract string Expression { get; }
public abstract void AddSort(object expr, IComparer comparer);
public abstract void AddSort(object expr, XmlSortOrder order, XmlCaseOrder caseOrder, string lang, XmlDataType dataType);
public abstract XPathExpression Clone();
public abstract void SetContext(XmlNamespaceManager nsManager);
public abstract void SetContext(IXmlNamespaceResolver nsResolver);
public abstract XPathResultType ReturnType { get; }
public static XPathExpression Compile(string xpath) {
return Compile(xpath, /*nsResolver:*/null);
}
public static XPathExpression Compile(string xpath, IXmlNamespaceResolver nsResolver) {
bool hasPrefix;
Query query = new QueryBuilder().Build(xpath, out hasPrefix);
CompiledXpathExpr expr = new CompiledXpathExpr(query, xpath, hasPrefix);
if (null != nsResolver) {
expr.SetContext(nsResolver);
}
return expr;
}
private void PrintQuery(XmlWriter w) {
((CompiledXpathExpr)this).QueryTree.PrintQuery(w);
}
}
}
|