47 {
49 if (root.Prefix.Length > 0)
50 {
52 }
55 if (root.Input != null)
56 {
58 if ((flags & Flags.PosFilter) == 0)
59 {
61 {
63 if (
axis.Input !=
null)
64 {
66 }
67 else
68 {
71 }
72 query =
new DescendantQuery(
qyParent, root.Name, root.Prefix, root.NodeType, matchSelf:
false,
axis.AbbrAxis);
74 {
76 }
79 }
80 if (root.TypeOfAxis ==
Axis.AxisType.Descendant || root.TypeOfAxis ==
Axis.AxisType.DescendantOrSelf)
81 {
83 }
84 }
86 }
87 else
88 {
89 query2 =
new ContextQuery();
91 }
92 switch (root.TypeOfAxis)
93 {
94 case Axis.AxisType.Ancestor:
95 query =
new XPathAncestorQuery(
query2, root.Name, root.Prefix, root.NodeType, matchSelf:
false);
97 break;
98 case Axis.AxisType.AncestorOrSelf:
99 query =
new XPathAncestorQuery(
query2, root.Name, root.Prefix, root.NodeType, matchSelf:
true);
101 break;
102 case Axis.AxisType.Child:
104 break;
105 case Axis.AxisType.Parent:
106 query =
new ParentQuery(
query2, root.Name, root.Prefix, root.NodeType);
107 break;
108 case Axis.AxisType.Descendant:
109 if ((flags & Flags.SmartDesc) != 0)
110 {
112 }
113 else
114 {
115 query =
new DescendantQuery(
query2, root.Name, root.Prefix, root.NodeType, matchSelf:
false, abbrAxis:
false);
117 {
119 }
120 }
122 break;
123 case Axis.AxisType.DescendantOrSelf:
124 if ((flags & Flags.SmartDesc) != 0)
125 {
126 query =
new DescendantOverDescendantQuery(
query2, matchSelf:
true, root.
Name, root.
Prefix, root.NodeType, root.AbbrAxis);
127 }
128 else
129 {
130 query =
new DescendantQuery(
query2, root.Name, root.Prefix, root.NodeType, matchSelf:
true, root.AbbrAxis);
132 {
134 }
135 }
137 break;
138 case Axis.AxisType.Preceding:
139 query =
new PrecedingQuery(
query2, root.Name, root.Prefix, root.NodeType);
141 break;
142 case Axis.AxisType.Following:
143 query =
new FollowingQuery(
query2, root.Name, root.Prefix, root.NodeType);
145 break;
146 case Axis.AxisType.FollowingSibling:
147 query =
new FollSiblingQuery(
query2, root.Name, root.Prefix, root.NodeType);
149 {
151 }
152 break;
153 case Axis.AxisType.PrecedingSibling:
154 query =
new PreSiblingQuery(
query2, root.Name, root.Prefix, root.NodeType);
155 break;
156 case Axis.AxisType.Attribute:
157 query =
new AttributeQuery(
query2, root.Name, root.Prefix, root.NodeType);
158 break;
159 case Axis.AxisType.Self:
160 query =
new XPathSelfQuery(
query2, root.Name, root.Prefix, root.NodeType);
161 break;
162 case Axis.AxisType.Namespace:
163 query = (((root.NodeType != XPathNodeType.All && root.NodeType != XPathNodeType.Element && root.NodeType !=
XPathNodeType.Attribute) || root.Prefix.Length != 0) ? ((
Query)
new EmptyQuery()) : ((
Query)
new NamespaceQuery(
query2, root.
Name, root.
Prefix, root.NodeType)));
164 break;
165 default:
167 }
169 }
Query ProcessNode(AstNode root, Flags flags, out Props props)
BaseAxisQuery _firstInput
static string Xp_NotSupported
static XPathException Create(string res)