Traversing an arbitrary C# object graph using XPath/applying XSL transforms

后端 未结 4 518
孤独总比滥情好
孤独总比滥情好 2021-01-04 09:21

I\'ve been looking for a component that would allow me to pass an arbitrary C# object to an XSL transform.

The naive way of doing this is to serialise the object gra

4条回答
  •  庸人自扰
    2021-01-04 10:00

    There's a (very) old MSDN article titled XPath Querying Over Objects with ObjectXPathNavigator that implements a similar class (Also called ObjectXPathNavigator, interestingly enough). I used this ages ago to query some data from Visual SourceSafe and build an RSS feed from the changelog, and it worked quite well. However, I didn't do XSLT with it, so I'm not sure if that works or not. Also, note that it was written for Framework 1.0, so you may need to update it for more recent frameoworks. Also, there may be better ways to do this now, but it would give you a starting point (and the article does a nice job of explaining how it works).

提交回复
热议问题