In the article Helena discusses XmlBookmarkReader, which is XmlReader implementation enabling you to set a bookmark at an XML node, read on and then rewind the reader back to the bookmarked node if you wish. That's really cool. It's implemented by caching all XML nodes after bookmarked one along with their context (such as Depth, attributes, namespaces etc). If you think for a moment about how XmlReader works you realize that it can be modeled as just traversing of a non-circular singly linked list of nodes. The nodes in that list are ordered in a document order (except for attributes and namespaces), which is usually called preorder tree traversal in non-XML circles. So at any moment you can start recording nodes XmlReader reads to the linked list and then come back and replay nodes by reading them from that list instead of source XML.
As a demonstration Helena shows an example of XML filtering, which requires look ahead - like selecting "/books/book[contains(title, 'XML')]". Obviously this can't be done with XmlTextReader, nor with XPathReader, but done easily with XmlBookmarkReader. As a matter of fact, XmlBookmarkReader is the feature XPathReader really needs. We can leverage XmlBookmarkReader when evaluating predicates in XPathReader so we can get back to the context node once we done with a predicate. Then XPathReader will finally be able to work with notorious "book[contains(title, 'XML')]". That's the way to go. With "look ahead" and "look back through ancestors" features XPathReader can finally be really useful. Btw, XPathReader workspace is open to everybody interested to participate. I just found out I'm admin there :)
PS. There is a small typo in the XmlBookmarkReader.cs - the line
if ( bookmarks.Count > 0 != null ) {should probably be
if ( bookmarks != null ) {
At least now I'm happy. I've got all my data in MySQL finally instead of file based Berkley DB, so now the blog posting/administration/rebuilding just flies, not crawls. No more timeouts on posting or removing comments or rebuilding archives.
And of course I've got now comment moderation and TypeKey based user registration. Now you can sign into TypeKey to post a comment - a recommended way. Alternatively you still can post a comment in an old way - with no sign in, but then such comment is a subject to a manual moderation - I need to approve it before it appears on a page.
Because I still allow unregistered comments I still get some comment spam, but at least now it doesn't make it into a page directly (so no page rebuilding on each input comment spam - what a relief for my hosting). So far so good. There are some more spam-fighting facilities I would set up if things go worse, at least MT-Blacklist is to be installed soon.
There are still some issues, e.g. when signing into TypeKey in Internet Explorer, the page doesn't reflect it and the message "Thanks for signing in... Now you can comment. (sign out)" doesn't appear untill page is reloaded. Oh, and when posting unregistered comment, some bad error message shows up:
(in cleanup) DBD::mysql::db disconnect failed: handle 2 is owned by thread 155f384 not current thread 22ef018 (handles can't be shared between threads and your driver may need a CLONE method added) at c:\hosting\webhost4life\member\olegt\cgi-bin\lib/MT/ObjectDriver/DBI.pm line 327.Wow, sounds bad, gotta report it to the MovableType forum.
Anyway, now I'm back to the blogsphere. Hello there!
nxslt is a small but feature-rich command line utility that allows to perform XSL Transformations (XSLT) using .NET Framework's XSLT implementation - System.Xml.Xsl.XslTransform class. nxslt basically dublicates functionality and command line options, provided by Microsoft's MSXSL.EXE Command Line Transformation Utility with small difference: unlike msxsl.exe, nxslt does not support specifying start mode. In addition, nxslt has some distinct advanced features, like support for XInclude, embedded stylesheets, custom URI resolving, multiple result documents, custom extension functions, built-in rich library of EXSLT extenstion functions etc.
D:\>nxslt.exe -? .NET XSLT command line utility, version 1.5 build 1860 (c) 2004 Oleg Tkachenko, http://www.tkachenko.com/dotnet/nxslt.html Running under .NET 1.1.4322.2032
Get it here (free/open source/BSD license).
More info at http://www.tkachenko.com/dotnet/nxslt.html.