简体   繁体   中英

Implementing my own XPathNavigator in C#

I am looking for a C# example implementation of a class derived from Microsoft's XPathNavigator class. Can any one point me at such an article?

As you may (or may not) know, the XmlNavigator is designed to allow one to superimpose XPath navigation on most any data model.

I have implemented my derived XPathNavigator class and it works very well. Very well that is except for XPath expressions that search recursively, ie "//*".

I am pretty sure that I have a subtle bug in the Clone, MoveToFirstChild, or MoveTo overides and I thought it might help to look at another example if one exists.

Also, I am sure that I have seen magazine articles that discuss this. My searches have proved yielded nothing. Maybe someone remembers such an article.

Look at this article by Aaron Skonnard:

" XPath Selections and Custom Functions, and More ",

which provides an example of a class derived from XPathNavigator .

A bug in your implementation or the MS one? If it's the MS one then you can use reflector to take a peek inside.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM