From the course: .NET Essentials: LINQ for XML
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Parse XML in an XML string - .NET Tutorial
From the course: .NET Essentials: LINQ for XML
Parse XML in an XML string
- There will be situations where the XML data is not in a file. Instead it's stashed in a string in your application. In this scenario, you'll want to use the parse method. That's what I'm doing here on line 3, I'm calling Element.Parse. Now, before I dig into the details, let's show you how you can look up information about these linked XML types, for instance, X Element. Now, if I hover over this I can see a link pad, press F1 to help. So let's do that. That opens up a browser and searches for this type that I can click on this link. That takes me to the Microsoft documentation site and I can see X Element and I can also see all of the other types that are part to link to XML. There's X comment, X document, X attribute, and more. We're looking at X element. So I can see methods like load and load a sync. We're looking at parse in this video. There's also save and save a sync. You can get information like I can…