In this post, I explored C# 3.0 and XLinq by parsing a music style XML document from MusicMoz. I created a simple class "TagCategory" to store the style name and category. Then, using XLinq, I loaded the XML, extracted the "style" elements, and created a List of TagCategory objects. The code concisely retrieves and stores the data using object initializers. Feel free to share your feedback or suggestions for improvement!
I've updated my C# regex for extracting CSS class names to correctly handle URLs in CSS properties like url(someimage.png). The previous version incorrectly matched file extensions. The improved regex uses a negative lookbehind assertion (?<!url\s*\(.*) to prevent matching class names within url() declarations. It now accurately extracts class names, even with variations in spacing within the url() function.
In a previous post, I shared a regular expression for extracting CSS class names, and a reader asked for clarification. This post addresses the question with a corrected regex and C# code example using Regex.Split and Regex.Match. The regex is designed to capture class names from CSS, even those containing escaped characters, and the example code demonstrates splitting a CSS string by class names and suggests using Regex.Match for obtaining the names themselves.
As part of my ongoing project to build a CSS 2.0 parser in C#, I've developed a regular expression based on the CSS 2.0 specification to extract class names from CSS files. This regex is a step towards creating a complete CSS 2.0 parser, and I plan to develop more regular expressions for other CSS elements in the coming days. Check out my related side project about creating a CSS 2.0 parser in C# for more context.
I noticed a lack of referrals from Technorati and discovered my blogs weren't showing up in tag searches. The problem stemmed from my Technorati AJAX application, which was using single quotes instead of double quotes around the href attribute in the tag links. I've corrected the issue by changing the single quotes to double quotes in my application, and hopefully, this will resolve the problem with Technorati. While my application is now fixed, it raises the question of whether Technorati should be able to handle both single and double quotes.
This post explores how to access and iterate through a user's Internet Explorer Favorites in C#. I've included C# code that retrieves the Favorites directory and recursively iterates through its folders and files. The code also parses the .URL files to extract the actual URLs. Currently, the code doesn't retrieve the friendly name displayed in the Favorites menu (e.g., "Microsoft" instead of "www.microsoft.com"), but I'm looking into using IShellLink for this and would appreciate any insights.