From: Oleg T. <he...@us...> - 2005-10-30 12:02:42
|
Update of /cvsroot/mvp-xml/EXSLT/v2/src/Exslt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8329/v2/src/Exslt Modified Files: ExsltRandom.cs GDNDynamic.cs Log Message: Index: GDNDynamic.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v2/src/Exslt/GDNDynamic.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- GDNDynamic.cs 16 Oct 2005 20:07:08 -0000 1.1 +++ GDNDynamic.cs 30 Oct 2005 12:02:31 -0000 1.2 @@ -38,7 +38,7 @@ /// <returns>Result of evaluating given Xpath expression WRT to context node.</returns> /// <remarks>THIS FUNCTION IS NOT PART OF EXSLT!!!</remarks> public object evaluate(XPathNodeIterator contextNode, string expression, string namespaces) - { + { if (expression == String.Empty || contextNode == null) return String.Empty; if (contextNode.MoveNext()) @@ -58,7 +58,7 @@ } while (node.MoveToNextNamespace()); } if (namespaces != String.Empty) - { + { try { Regex regexp = new Regex(@"xmlns:(?<p>\w+)\s*=\s*(('(?<n>.+)')|(""(?<n>.+)""))\s*"); @@ -66,7 +66,7 @@ while (m.Success) { try - { + { context.AddNamespace(m.Groups["p"].Value, m.Groups["n"].Value); } @@ -75,12 +75,12 @@ } } catch {} - } - expr.SetContext(context); + } + expr.SetContext(context); return contextNode.Current.Evaluate(expr, contextNode); } catch - { + { //Any exception such as syntax error in XPath return String.Empty; } Index: ExsltRandom.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v2/src/Exslt/ExsltRandom.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ExsltRandom.cs 16 Oct 2005 20:07:08 -0000 1.1 +++ ExsltRandom.cs 30 Oct 2005 12:02:31 -0000 1.2 @@ -79,6 +79,9 @@ XmlDocument doc = new XmlDocument(); doc.LoadXml("<randoms/>"); + if (seed == int.MinValue) + seed += 1; + Random rand = new Random(seed); //Negative number is bad idea - fallback to default |