I've been feeling like start doing some fun stuff with my delicious bookmarks and LINQ to XML, and I was wondering if there's a way to split the tag attribute within LINQ.
What I've meant with split the tag within LINQ was generating a collection of strings for each post element, so the expected result would be a generic collection of post
elements, with its attributes as properties, where the tag
property is itself another collection of strings, with its items being each tag.
For those not quite familiar with delicious.com's exported xml, here´s the basic structure of an element:
<post
href="http://stackoverflow.com/"
hash="e4a42d992025b928a586b8bdc36ad38d"
description="Stack Overflow"
tag="code development programming community tips answers reference"
time="2009-05-22T19:44:09Z"
extended="Stack Overflow is a programming Q & A site that's free."
meta="e0bf85c9df073cd51cc5528637db5277"
/>
Here's the snippet of code I'm using:
XDocument delicious = XDocument.Load("all.xml");
var bookmarks = from posts in delicious.Descendants().Attributes("tag")
select (string)posts;
Any ideas, suggestions, comments would be really appreciated.