1 <?xml version="1.0" encoding="utf-8"?>
2 <Type Name="Extensions" FullName="System.Xml.XPath.Extensions">
3 <TypeSignature Language="C#" Value="public static class Extensions" />
4 <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit Extensions extends System.Object" />
6 <AssemblyName>System.Xml.Linq</AssemblyName>
7 <AssemblyVersion>4.0.0.0</AssemblyVersion>
10 <BaseTypeName>System.Object</BaseTypeName>
15 <attribution license="cc4" from="Microsoft" modified="false" />
16 <para>There is some performance penalty for using these methods. Using sqltecxlinq queries yields better performance.</para>
17 <para>Although the ordering of returned collections is not specified in the XML XPath Language 1.0 Recommendation, this extension method returns nodes in document order.</para>
18 <para>Note that nodes are returned in document order even when you use a reverse axis, such as preceding-sibling or ancestor-or-self.</para>
21 <attribution license="cc4" from="Microsoft" modified="false" />
22 <para>This class contains the sqltecxlinq extension methods that enable you to evaluate XPath expressions.</para>
26 <Member MemberName="CreateNavigator">
27 <MemberSignature Language="C#" Value="public static System.Xml.XPath.XPathNavigator CreateNavigator (this System.Xml.Linq.XNode node);" />
28 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.XPath.XPathNavigator CreateNavigator(class System.Xml.Linq.XNode node) cil managed" />
29 <MemberType>Method</MemberType>
31 <AssemblyVersion>4.0.0.0</AssemblyVersion>
34 <ReturnType>System.Xml.XPath.XPathNavigator</ReturnType>
37 <Parameter Name="node" Type="System.Xml.Linq.XNode" RefType="this" />
41 <attribution license="cc4" from="Microsoft" modified="false" />
42 <para>You cannot edit the XML tree by using the <see cref="T:System.Xml.XPath.XPathNavigator" /> that is returned by this method. The <see cref="P:System.Xml.XPath.XPathNavigator.CanEdit" /> property returns false.</para>
43 <para>You cannot create an <see cref="T:System.Xml.XPath.XPathNavigator" /> for a <see cref="T:System.Xml.Linq.XDocumentType" /> node. Document types do not participate in the XPath data model.</para>
44 <para>Namespace declarations are reported from left to right. In contrast, for <see cref="T:System.Xml.XmlDocument" /> namespaces are reported from right to left. This is conformant behavior because namespace declarations are not ordered in the XPath data model.</para>
45 <para>The method <see cref="M:System.Xml.XPath.XPathNavigator.MoveToId(System.String)" /> is not supported for navigators that are returned by this method.</para>
46 <para>You can use this method to perform an XSLT transformation. You can create an XML tree, create an <see cref="T:System.Xml.XPath.XPathNavigator" /> from the XML tree, create a new document, and create a <see cref="T:System.Xml.XmlWriter" /> that will write into the new document. Then, you can invoke the XSLT transformation, passing the <see cref="T:System.Xml.XPath.XPathNavigator" /> and <see cref="T:System.Xml.XmlWriter" /> to the transform. After the transformation successfully completes, the new XML tree is populated with the results of the transformation.</para>
47 <para>To perform an XSLT transformation, you can use either an <see cref="T:System.Xml.XmlReader" /> or an <see cref="T:System.Xml.XPath.XPathNavigator" />. The two approaches have different performance characteristics. Some transformations will execute faster when using an <see cref="T:System.Xml.XmlReader" />, and others will execute faster when using a <see cref="T:System.Xml.XPath.XPathNavigator" />. If performance is a concern, we recommend that you experiment with each approach to determine which will perform better in your circumstances.</para>
50 <attribution license="cc4" from="Microsoft" modified="false" />
51 <para>Creates an <see cref="T:System.Xml.XPath.XPathNavigator" /> for an <see cref="T:System.Xml.Linq.XNode" />.</para>
54 <attribution license="cc4" from="Microsoft" modified="false" />
55 <para>An <see cref="T:System.Xml.XPath.XPathNavigator" /> that can process XPath queries.</para>
58 <attribution license="cc4" from="Microsoft" modified="false" />An <see cref="T:System.Xml.Linq.XNode" /> that can process XPath queries.</param>
61 <Member MemberName="CreateNavigator">
62 <MemberSignature Language="C#" Value="public static System.Xml.XPath.XPathNavigator CreateNavigator (this System.Xml.Linq.XNode node, System.Xml.XmlNameTable nameTable);" />
63 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.XPath.XPathNavigator CreateNavigator(class System.Xml.Linq.XNode node, class System.Xml.XmlNameTable nameTable) cil managed" />
64 <MemberType>Method</MemberType>
66 <AssemblyVersion>4.0.0.0</AssemblyVersion>
69 <ReturnType>System.Xml.XPath.XPathNavigator</ReturnType>
72 <Parameter Name="node" Type="System.Xml.Linq.XNode" RefType="this" />
73 <Parameter Name="nameTable" Type="System.Xml.XmlNameTable" />
77 <attribution license="cc4" from="Microsoft" modified="false" />
78 <para>You cannot edit the XML tree using the <see cref="T:System.Xml.XPath.XPathNavigator" /> that is returned by this method. The <see cref="P:System.Xml.XPath.XPathNavigator.CanEdit" /> property returns false.</para>
79 <para>You cannot create an <see cref="T:System.Xml.XPath.XPathNavigator" /> for a <see cref="T:System.Xml.Linq.XDocumentType" /> node. Document types do not participate in the XPath data model.</para>
80 <para>Namespace declarations are reported from left to right. In contrast, for <see cref="T:System.Xml.XmlDocument" /> namespaces are reported from right to left. This is conformant behavior because namespace declarations are not ordered in the XPath data model.</para>
81 <para>The method <see cref="M:System.Xml.XPath.XPathNavigator.MoveToId(System.String)" /> is not supported for navigators that are returned by this method.</para>
82 <para>If you use an <see cref="T:System.Xml.XmlNameTable" /> with this method to create the <see cref="T:System.Xml.XPath.XPathNavigator" />, you will get better performance when evaluating XPath expressions.</para>
85 <attribution license="cc4" from="Microsoft" modified="false" />
86 <para>Creates an <see cref="T:System.Xml.XPath.XPathNavigator" /> for an <see cref="T:System.Xml.Linq.XNode" />. The <see cref="T:System.Xml.XmlNameTable" /> enables more efficient XPath expression processing.</para>
89 <attribution license="cc4" from="Microsoft" modified="false" />
90 <para>An <see cref="T:System.Xml.XPath.XPathNavigator" /> that can process XPath queries.</para>
93 <attribution license="cc4" from="Microsoft" modified="false" />An <see cref="T:System.Xml.Linq.XNode" /> that can process an XPath query.</param>
94 <param name="nameTable">
95 <attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.Xml.XmlNameTable" /> to be used by <see cref="T:System.Xml.XPath.XPathNavigator" />.</param>
98 <Member MemberName="XPathEvaluate">
99 <MemberSignature Language="C#" Value="public static object XPathEvaluate (this System.Xml.Linq.XNode node, string expression);" />
100 <MemberSignature Language="ILAsm" Value=".method public static hidebysig object XPathEvaluate(class System.Xml.Linq.XNode node, string expression) cil managed" />
101 <MemberType>Method</MemberType>
103 <AssemblyVersion>4.0.0.0</AssemblyVersion>
106 <ReturnType>System.Object</ReturnType>
109 <Parameter Name="node" Type="System.Xml.Linq.XNode" RefType="this" />
110 <Parameter Name="expression" Type="System.String" />
114 <attribution license="cc4" from="Microsoft" modified="false" />
115 <para>If the collection is an enumeration of elements or attributes, you can use the Cast operator to get a collection of <see cref="T:System.Xml.Linq.XElement" /> or <see cref="T:System.Xml.Linq.XAttribute" />.</para>
116 <para>Although the ordering of returned collections is not specified in the XML XPath Language 1.0 Recommendation, this extension method returns nodes in document order.</para>
117 <para>Note that nodes are returned in document order even when you use a reverse axis, such as preceding-sibling or ancestor-or-self.</para>
120 <attribution license="cc4" from="Microsoft" modified="false" />
121 <para>Evaluates an XPath expression.</para>
124 <attribution license="cc4" from="Microsoft" modified="false" />
125 <para>An object that can contain a bool, a double, a string, or an <see cref="T:System.Collections.Generic.IEnumerable`1" />. </para>
128 <attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.Xml.Linq.XNode" /> on which to evaluate the XPath expression.</param>
129 <param name="expression">
130 <attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.String" /> that contains an XPath expression.</param>
133 <Member MemberName="XPathEvaluate">
134 <MemberSignature Language="C#" Value="public static object XPathEvaluate (this System.Xml.Linq.XNode node, string expression, System.Xml.IXmlNamespaceResolver resolver);" />
135 <MemberSignature Language="ILAsm" Value=".method public static hidebysig object XPathEvaluate(class System.Xml.Linq.XNode node, string expression, class System.Xml.IXmlNamespaceResolver resolver) cil managed" />
136 <MemberType>Method</MemberType>
138 <AssemblyVersion>4.0.0.0</AssemblyVersion>
141 <ReturnType>System.Object</ReturnType>
144 <Parameter Name="node" Type="System.Xml.Linq.XNode" RefType="this" />
145 <Parameter Name="expression" Type="System.String" />
146 <Parameter Name="resolver" Type="System.Xml.IXmlNamespaceResolver" />
150 <attribution license="cc4" from="Microsoft" modified="false" />
151 <para>You can use this method to evaluate XPath expressions that contain namespace prefixes.</para>
152 <para>Although the ordering of returned collections is not specified in the XML XPath Language 1.0 Recommendation, this extension method returns nodes in document order.</para>
153 <para>Note that nodes are returned in document order even when you use a reverse axis, such as preceding-sibling or ancestor-or-self.</para>
156 <attribution license="cc4" from="Microsoft" modified="false" />
157 <para>Evaluates an XPath expression, resolving namespace prefixes using the specified <see cref="T:System.Xml.IXmlNamespaceResolver" />.</para>
160 <attribution license="cc4" from="Microsoft" modified="false" />
161 <para>An object that contains the result of evaluating the expression. The object can be a bool, a double, a string, or an <see cref="T:System.Collections.Generic.IEnumerable`1" />.</para>
164 <attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.Xml.Linq.XNode" /> on which to evaluate the XPath expression.</param>
165 <param name="expression">
166 <attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.String" /> that contains an XPath expression.</param>
167 <param name="resolver">
168 <attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.Xml.IXmlNamespaceResolver" /> for the namespace prefixes in the XPath expression.</param>
171 <Member MemberName="XPathSelectElement">
172 <MemberSignature Language="C#" Value="public static System.Xml.Linq.XElement XPathSelectElement (this System.Xml.Linq.XNode node, string expression);" />
173 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.Linq.XElement XPathSelectElement(class System.Xml.Linq.XNode node, string expression) cil managed" />
174 <MemberType>Method</MemberType>
176 <AssemblyVersion>4.0.0.0</AssemblyVersion>
179 <ReturnType>System.Xml.Linq.XElement</ReturnType>
182 <Parameter Name="node" Type="System.Xml.Linq.XNode" RefType="this" />
183 <Parameter Name="expression" Type="System.String" />
186 <remarks>To be added.</remarks>
188 <attribution license="cc4" from="Microsoft" modified="false" />
189 <para>Selects an <see cref="T:System.Xml.Linq.XElement" /> using a XPath expression.</para>
192 <attribution license="cc4" from="Microsoft" modified="false" />
193 <para>An <see cref="T:System.Xml.Linq.XElement" />, or null.</para>
196 <attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.Xml.Linq.XNode" /> on which to evaluate the XPath expression.</param>
197 <param name="expression">
198 <attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.String" /> that contains an XPath expression.</param>
201 <Member MemberName="XPathSelectElement">
202 <MemberSignature Language="C#" Value="public static System.Xml.Linq.XElement XPathSelectElement (this System.Xml.Linq.XNode node, string expression, System.Xml.IXmlNamespaceResolver resolver);" />
203 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.Linq.XElement XPathSelectElement(class System.Xml.Linq.XNode node, string expression, class System.Xml.IXmlNamespaceResolver resolver) cil managed" />
204 <MemberType>Method</MemberType>
206 <AssemblyVersion>4.0.0.0</AssemblyVersion>
209 <ReturnType>System.Xml.Linq.XElement</ReturnType>
212 <Parameter Name="node" Type="System.Xml.Linq.XNode" RefType="this" />
213 <Parameter Name="expression" Type="System.String" />
214 <Parameter Name="resolver" Type="System.Xml.IXmlNamespaceResolver" />
218 <attribution license="cc4" from="Microsoft" modified="false" />
219 <para>You can use this method to evaluate XPath expressions that contain namespace prefixes.</para>
222 <attribution license="cc4" from="Microsoft" modified="false" />
223 <para>Selects an <see cref="T:System.Xml.Linq.XElement" /> using a XPath expression, resolving namespace prefixes using the specified <see cref="T:System.Xml.IXmlNamespaceResolver" />.</para>
226 <attribution license="cc4" from="Microsoft" modified="false" />
227 <para>An <see cref="T:System.Xml.Linq.XElement" />, or null.</para>
230 <attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.Xml.Linq.XNode" /> on which to evaluate the XPath expression.</param>
231 <param name="expression">
232 <attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.String" /> that contains an XPath expression.</param>
233 <param name="resolver">
234 <attribution license="cc4" from="Microsoft" modified="false" />An <see cref="T:System.Xml.IXmlNamespaceResolver" /> for the namespace prefixes in the XPath expression.</param>
237 <Member MemberName="XPathSelectElements">
238 <MemberSignature Language="C#" Value="public static System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> XPathSelectElements (this System.Xml.Linq.XNode node, string expression);" />
239 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Generic.IEnumerable`1<class System.Xml.Linq.XElement> XPathSelectElements(class System.Xml.Linq.XNode node, string expression) cil managed" />
240 <MemberType>Method</MemberType>
242 <AssemblyVersion>4.0.0.0</AssemblyVersion>
245 <ReturnType>System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement></ReturnType>
248 <Parameter Name="node" Type="System.Xml.Linq.XNode" RefType="this" />
249 <Parameter Name="expression" Type="System.String" />
253 <attribution license="cc4" from="Microsoft" modified="false" />
254 <para>Although the ordering of returned collections is not specified in the XML XPath Language 1.0 Recommendation, this extension method returns nodes in document order.</para>
255 <para>Note that nodes are returned in document order even when you use a reverse axis, such as preceding-sibling or ancestor-or-self.</para>
258 <attribution license="cc4" from="Microsoft" modified="false" />
259 <para>Selects a collection of elements using an XPath expression.</para>
262 <attribution license="cc4" from="Microsoft" modified="false" />
263 <para>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XElement" /> that contains the selected elements.</para>
266 <attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.Xml.Linq.XNode" /> on which to evaluate the XPath expression.</param>
267 <param name="expression">
268 <attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.String" /> that contains an XPath expression.</param>
271 <Member MemberName="XPathSelectElements">
272 <MemberSignature Language="C#" Value="public static System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> XPathSelectElements (this System.Xml.Linq.XNode node, string expression, System.Xml.IXmlNamespaceResolver resolver);" />
273 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Generic.IEnumerable`1<class System.Xml.Linq.XElement> XPathSelectElements(class System.Xml.Linq.XNode node, string expression, class System.Xml.IXmlNamespaceResolver resolver) cil managed" />
274 <MemberType>Method</MemberType>
276 <AssemblyVersion>4.0.0.0</AssemblyVersion>
279 <ReturnType>System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement></ReturnType>
282 <Parameter Name="node" Type="System.Xml.Linq.XNode" RefType="this" />
283 <Parameter Name="expression" Type="System.String" />
284 <Parameter Name="resolver" Type="System.Xml.IXmlNamespaceResolver" />
288 <attribution license="cc4" from="Microsoft" modified="false" />
289 <para>You can use this method to evaluate XPath expressions that contain namespace prefixes.</para>
290 <para>Although the ordering of returned collections is not specified in the XML XPath Language 1.0 Recommendation, this extension method returns nodes in document order.</para>
291 <para>Note that nodes are returned in document order even when you use a reverse axis, such as preceding-sibling or ancestor-or-self.</para>
294 <attribution license="cc4" from="Microsoft" modified="false" />
295 <para>Selects a collection of elements using an XPath expression, resolving namespace prefixes using the specified <see cref="T:System.Xml.IXmlNamespaceResolver" />.</para>
298 <attribution license="cc4" from="Microsoft" modified="false" />
299 <para>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XElement" /> that contains the selected elements.</para>
302 <attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.Xml.Linq.XNode" /> on which to evaluate the XPath expression.</param>
303 <param name="expression">
304 <attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.String" /> that contains an XPath expression.</param>
305 <param name="resolver">
306 <attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.Xml.IXmlNamespaceResolver" /> for the namespace prefixes in the XPath expression.</param>