* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / System.XML / System.Xml.XPath / XPathExpression.cs
index b29d756526f92f0e7b8f17b8ae8138b945b1a594..db70fde6d44d04b6ff47226b3c7ad18ed8294980 100644 (file)
 //
 
 using System.Collections;
+using Mono.Xml.XPath;
+
+#if NET_2_0
+using NSResolver = System.Xml.IXmlNamespaceResolver;
+#else
+using NSResolver = System.Xml.XmlNamespaceManager;
+#endif
 
 namespace System.Xml.XPath
 {
@@ -66,6 +73,34 @@ namespace System.Xml.XPath
 
                public abstract void SetContext (XmlNamespaceManager nsManager);
 
+#if NET_2_0
+               public
+#else
+               internal
+#endif
+               static XPathExpression Compile (string xpath)
+               {
+                       return Compile (xpath, null, null);
+               }
+
+#if NET_2_0
+               public static XPathExpression Compile (
+                       string xpath, NSResolver nsmgr)
+               {
+                       return Compile (xpath, nsmgr, null);
+               }
+#endif
+
+               internal static XPathExpression Compile (string xpath,
+                       NSResolver nsmgr, System.Xml.Xsl.IStaticXsltContext ctx)
+               {
+                       XPathParser parser = new XPathParser (ctx);
+                       XPathExpression x = new CompiledExpression (
+                               xpath, parser.Compile (xpath));
+                       x.SetContext (nsmgr);
+                       return x;
+               }
+
 #if NET_2_0
                public abstract void SetContext (IXmlNamespaceResolver nsResolver);
 #endif