From the course: .NET Essentials: LINQ for XML

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Challenge: Move attributes and elements

Challenge: Move attributes and elements - .NET Tutorial

From the course: .NET Essentials: LINQ for XML

Start my 1-month free trial

Challenge: Move attributes and elements

(upbeat music) - [Instructor] It's time for another code challenge. Here's the problem, we're going to look at the contents of WebColorsA.xml, and we're going to take one of the color values, or I should say all the color values that are in there. And I want you to transform them. So, here's what we have for the original. We've got color name and color family as attributes. We've got the hex value, we have red, green, and blue and then we have hue, saturation, and lightness. So, your job is to remove the attributes and turn those into elements, color name element and the color family element. (inhales deeply) You'll leave hex alone, that's going to stay as a child of color. And then, you're going to create a new parent element RGB and a new HSL element. And you're going to move red, green, and blue into the RGB element. And you're going to move hue, saturation and lightness into the HSL element. Now, it's your turn…

Contents