projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'marek'
[mono.git]
/
mcs
/
class
/
System.Web
/
System.Web.UI
/
XPathBinder.cs
diff --git
a/mcs/class/System.Web/System.Web.UI/XPathBinder.cs
b/mcs/class/System.Web/System.Web.UI/XPathBinder.cs
index 69cdb9af6f8dbe7b1bd70f6934e4e790ed3afdc4..135edad6a4b7007d5292ee1bfd2eb6a648742776 100644
(file)
--- a/
mcs/class/System.Web/System.Web.UI/XPathBinder.cs
+++ b/
mcs/class/System.Web/System.Web.UI/XPathBinder.cs
@@
-28,54
+28,71
@@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Collections;
using System.Collections.Specialized;
using System.Text;
using System.Xml.XPath;
using System.Xml;
using System.Collections;
using System.Collections.Specialized;
using System.Text;
using System.Xml.XPath;
using System.Xml;
-namespace System.Web.UI {
- public sealed class XPathBinder {
- private XPathBinder ()
+namespace System.Web.UI
+{
+ public sealed class XPathBinder
+ {
+ XPathBinder ()
{
}
{
}
-
+
public static object Eval (object container, string xpath)
public static object Eval (object container, string xpath)
+ {
+ return Eval (container, xpath, (IXmlNamespaceResolver)null);
+ }
+
+ public static object Eval (object container, string xpath, IXmlNamespaceResolver resolver)
{
if (xpath == null || xpath.Length == 0)
throw new ArgumentNullException ("xpath");
{
if (xpath == null || xpath.Length == 0)
throw new ArgumentNullException ("xpath");
-
+
IXPathNavigable factory = container as IXPathNavigable;
IXPathNavigable factory = container as IXPathNavigable;
-
+
if (factory == null)
throw new ArgumentException ("container");
if (factory == null)
throw new ArgumentException ("container");
-
- object result = factory.CreateNavigator ().Evaluate (xpath);
-
+
+ object result = factory.CreateNavigator ().Evaluate (xpath
, resolver
);
+
XPathNodeIterator itr = result as XPathNodeIterator;
if (itr != null) {
XPathNodeIterator itr = result as XPathNodeIterator;
if (itr != null) {
- if (itr.MoveNext())
+ if (itr.MoveNext
())
return itr.Current.Value;
else
return null;
}
return itr.Current.Value;
else
return null;
}
+
return result;
}
return result;
}
-
+
public static string Eval (object container, string xpath, string format)
{
public static string Eval (object container, string xpath, string format)
{
- object result = Eval (container, xpath);
+ return Eval (container, xpath, format, null);
+ }
+
+ public static string Eval (object container, string xpath, string format, IXmlNamespaceResolver resolver)
+ {
+ object result = Eval (container, xpath, resolver);
if (result == null)
return String.Empty;
if (format == null || format.Length == 0)
return result.ToString ();
if (result == null)
return String.Empty;
if (format == null || format.Length == 0)
return result.ToString ();
-
+
return String.Format (format, result);
}
public static IEnumerable Select (object container, string xpath)
return String.Format (format, result);
}
public static IEnumerable Select (object container, string xpath)
+ {
+ return Select (container, xpath, null);
+ }
+
+ public static IEnumerable Select (object container, string xpath, IXmlNamespaceResolver resolver)
{
if (xpath == null || xpath.Length == 0)
throw new ArgumentNullException ("xpath");
{
if (xpath == null || xpath.Length == 0)
throw new ArgumentNullException ("xpath");
@@
-85,7
+102,7
@@
namespace System.Web.UI {
if (factory == null)
throw new ArgumentException ("container");
if (factory == null)
throw new ArgumentException ("container");
- XPathNodeIterator itr = factory.CreateNavigator ().Select (xpath);
+ XPathNodeIterator itr = factory.CreateNavigator ().Select (xpath
, resolver
);
ArrayList ret = new ArrayList ();
while (itr.MoveNext ()) {
ArrayList ret = new ArrayList ();
while (itr.MoveNext ()) {
@@
-99,5
+116,4
@@
namespace System.Web.UI {
}
}
}
}
-#endif