开发者

XmlDataSource with XPath - can I get the raw data in code?

If an ASP.NET form has an XmlDataSource on it, and in code I am setting the X开发者_运维知识库Path filter, e.g:

xmlExample.XPath = 
     String.Format("data/reasons/reason[@text='{0}']/details/",someValue);

... can I then get the result of that XPath filtering in code, or do I have to bind to a control to find out the results?

In other words, is it possible to use code to access the xml data that an XmlDataSource is going to return?


I haven't actually tried it, but the documentation for XmlDataSource.GetXmlDocument (new with .NET 2.0) suggests it will do exactly what you want:

Return Value

An XmlDataDocument that represents the XML specified in the Data property or in the file identified by the DataFile property, with any transformations and XPath queries applied.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜