{Unqualified}Linq

I have been increasingly using XLinq for various small tasks and it really is quite productive.

Recently however, a problem arose whereby a colleague asked for a solution to how he could possibly deal with XML documents with any namespaces in the same way.

That is, it whether an element was called {foo}bar or {}bar could not have any significance to his code.

Therefore I devised a couple of simple extension methods to deal with this issue. The solution, which is easily replicatable with a little knowledge of LINQ and System.Xml.Linq, is used like this

var isbn = doc.LElement("book").LElement("isbn");

I reimplemented these with provisions for attribute support on extensia.codeplex.com – feel free to use.

Advertisements

About xosfaere

Software Developer
This entry was posted in Program, Software, Technical and tagged , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s