Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I evaluate an XPath expression in Silverlight?

I need to allow an advanced user to enter an XPath expression and show them the value(s) or nodes or attributes found. In the .Net framework, the System.Xml.XPath.Extensions can be used to call XPathEvaluate, but Silverlight doesn't have this MSDN reference. Has anyone rewritten the extension methods for use in Silverlight? What is the best approach to take? Why aren't they available in Silverlight or in the toolkit (vote on the issue here)?

like image 977
AlignedDev Avatar asked Nov 15 '22 12:11

AlignedDev


1 Answers

I think the reason XPath is not available in Silverlight is that MS wants you to use Linq to XML instead. But that doesn't exactly help you. Unfortunately I think it will be difficult to achieve what you want. If you must have this functionality I think you will have to resort to sending your query to the server, evaluating it there, and returning the result. It is ugly, but I think it is the only way.

like image 146
Henrik Söderlund Avatar answered Jan 01 '23 09:01

Henrik Söderlund