Removing duplicate namespaces in XML Literals (Shyam Namboodiripad)

A common problem that one often runs into with XML literals and the LINQ to XML API is duplicate XML namespaces. Consider the following example. The code imports a default XML namespace – “hello”. Code: Imports <xmlns=“hello“> Module Module1     Sub Main()         Dim x = <A>                     <%= <B></B> %>                 </A>         Console.WriteLine(“x:”)… Read more

VB XML Cookbook, Recipe 7: Enumerating Large XML Files (Doug Rothaus)

VB XML Cookbook, Recipe 7: Enumerating Large XML Files (Doug Rothaus) It’s been a while since I wrote one of these XML cookbook entries. Here’s some info on a common problem: Really big XML files. I’m going to show you two things in this recipe. The first is a tip on reading very large XML… Read more

Using HTML entities in XML Literals (Avner Aharoni)

One of the common use-cases of XML literals is creating HTML. However, HTML entities cannot be used in XML literals since LINQ to XML directly supports only the Data type definitions (DTD) defined in the XML 1.0 spec. You can read more about it here. The workaround is to use the Unicode representation of the… Read more

Editing XML Literals Embedded Expressions in Visual Basic 2010 (Avner Aharoni)

The implicit line continuation feature in Visual Basic 2010 provided an opportunity to improve the code editing experience in XML literals embedded expressions. In Visual Studio 2008, pressing Enter inside an embedded expression would result in the cursor being positioned to the left of the end embedded expression tag. In Visual Studio 2010, pressing Enter… Read more

Fun With Dynamic Objects (Doug Rothaus)

A while back, I remember being asked if there was a simple way to expose a source XML document as an object with properties. That is, if the root XML element had a child element <Name>Doug</Name>, then the object would have a Name property that was a string and returned “Doug”. The catch was that… Read more

Linking Zune media items with LinQ, Part 2 (Matt Gertz)

In this post, I’ll continue on with coding the new playlist shuffler.  If you haven’t read part 1 yet, I highly recommend it so that this post will make more sense. J Code for the controls (continued) The Title TextBox When the title changes, we’ll want to indicate that the playlist has changed, and we’ll… Read more

Linking Zune media items with LinQ, Part 1 (Matt Gertz)

Way back in October 2007, I wrote up a few posts (here and here) on my experiments with the Windows Media Player object model.  The problem I was trying to solve was that, when I had a playlist set to “shuffle,” WMP would break up songs that should always play together (for example, Jackson Browne’s… Read more

XML Literals, WCF and LINQ Article by Steele Price (Lisa Feigenbaum)

Steele wrote a great article in last month’s issue of Visual Studio Magazine on XML Literals, WCF and LINQ. He shows how to use these three technologies together to produce more responsive ASP.NET pages, and more readable code. Lots of great tips for VB 2008. VSM’s “On VB” Column: XML Literals, WCF and LINQ by… Read more

.NET Rocks! with Beth Massi on the Open XML SDK and XML Literals (Lisa Feigenbaum)

Beth Massi shot a couple of great episodes last month on dnrTV! If you are interested in learning more about the Open XML SDK, and how to easily access it using VB.NET XML Literals, be sure to check them out. dnrTV Show #137: Beth Massi on the Open XML SDK Our good friend Beth Massi… Read more

When using LINQ to XML why don’t I get results if I don’t import a XML namespace (Daniel Walzenbach)?

Hi, I posted a bit of code the other day which I used to get a list of all Code Snippets we ship in Visual Studio. In a nutshell, I used XElement.Load to create a new XML document from a filename from which I then read elements from (There are way to many ‘”from” in… Read more