I do like XPath, I really do.
But I'm working on the compact framework which XPath is not included.
So I come to understanding that if XPath do not come to the mountain,
The mountain will come to XPath.
I decided to build an XPath evaluation helper with will get XmlTextReader
and XPath string, and it will return XmlTextReader that will be the result
of the XPath.
The signature should be something like that:
XmlTextReader XPathHelper (XmlTextReader reader, string xpath)
The thing that I'm querying the community is does a similar code already
exist on the internet, and I'm going to spend my time on an existing issue.
Any way I will be glad to hear if you have a suggestion for the architecture
of such helper.
I thought of something simple which will ignore ancestor axis for the start.
And it seems to me like a recursive method which dealing with one operation
at a time and then recurs the call with the result reader and the XPath
ahead of the already handled operation.
Which mean the "//Book/Author[@name='Mike']" XPath will:
1.. Iterate around all Book tags
2.. forward the result reader with the " /Author[@name='Mike']" ahead
3.. Iterate around all Author tags
4.. forward the result reader with the " [@name='Mike']" ahead
5.. then return reader if there is attribute "name='Mike'" else return
null