SRC_ C#:Learning XPath Language in 30 minutes
Recently I stumbled across .Net Xml classes. (As I'm not born English speaker, I realize that some of my writings are hard to understand, and I feel the former sentence is one of them. So in short it means: I had to used XmlDocument class in my code)
Well the Xml routines in .Net are reeeeally good. I like the ease of using Xml in .Net, but I should confess that I was much impressed by the XPath language. This is a simple language to query and filter data stored in XML documents. I have no illusions that this is some complex "brain surgery" language and the language is not brain new either(to be precise, the w3c site says XPath 1.0 dates back to 1999). Although XPath is not complex nor it is new, it is one of those languages that are easier to learn by examples than by reading documentation (if you prefer read that one as: it is easier to learn things when you see examples of what you learn).
So to help myself, I built a simple application that takes Xml and XPath expression and shows the result. I bet there are thousands applications of the kind, much sophisticated and with more features, but I like my own. It took me 40 minutes to write from scratch and it does all that I need, it helps me writing and verifying XPath expressions.
Finally, here is my recipe for learning XPath Language:
1) Get XPathSample.zip, extract and run XPathSample.exe or if you prefer compile it yourself from the sources
2) Check the examples of XPath expressions on the MSDN site.
You might also browse higher in the directory tree to see XPath syntax if you wish.
3) Play 30 minutes with the app from 1) using examples from 2)
4) Congratulations!!! You are XPath expert now :)
Now go play some WARBEARS:
Wednesday, March 08, 2006
© 2002 - 2008 Kroum Grigorov