Home All Groups Group Topic Archive Search About

Is it possible to use regular expressions inside of an xpath statement executed by System.Xml.XmlDoc

Author
24 May 2006 12:43 AM
Daniel
Is it possible to use regular expressions inside of an xpath statement
executed by System.Xml.XmlDocument.SelectSingleNode() ?

   string sdoc = "<foo><bar a='1'/><bar a='2'/></foo>";
   System.Xml.XmlDocument pdoc = new System.Xml.XmlDocument();
   pdoc.LoadXml(sdoc);
   System.Xml.XmlNode pnode =
pdoc.SelectSingleNode("//foo/bar/matches(.,'\\d')");
   string foo = pnode.InnerText;
   int i23 = 23 + 23;

AddThis Social Bookmark Button