Groups | Blog | Home
all groups > dotnet xml > june 2004 >

dotnet xml : An unhandled exception of type 'System.Xml.Xsl.XsltException' occu


one
6/13/2004 9:21:01 PM
Hi, can some experts out there tell me why I am getting:
An unhandled exception of type 'System.Xml.Xsl.XsltException' occurred in system.xml.dll... (No details in the error dialog box)

FileStream fs = new FileStream("test.xml",FileMode.OpenOrCreate);
StreamReader sr = new StreamReader(fs);
XmlTextReader xtr = new XmlTextReader(sr);
XmlDocument xd = new XmlDocument();
xd.Load(xtr);
XmlElement root = xd.DocumentElement;
XmlNamespaceManager ns = new XmlNamespaceManager(xd.NameTable);
ns.AddNamespace("soap", @"http://schemas.xmlsoap.org/soap/envelope/");
string temp = @"soap:Envelope/soap:Body/test:TestMessage/test:Body/test:Text";
XmlNodeList nl = root.SelectNodes(temp, ns); <---- This line throw the exception.

I am thinking maybe the dotnet framework doesn't like the colon in the XPath? Has anyone seen this before?
Oleg Tkachenko [MVP]
6/14/2004 11:25:59 AM
[quoted text, click to view]

You should aslo add a namespace binding for "test" namespace prefix.

[quoted text, click to view]

--
Oleg Tkachenko [XML MVP]
AddThis Social Bookmark Button