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.

Query for empty elements and blank values

Query for empty elements and blank values - .NET Tutorial

From the course: .NET Essentials: LINQ for XML

Start my 1-month free trial

Query for empty elements and blank values

- [Instructor] Depending on how you get your XML data you may need to do some validation on what's there. And if you have an XML schema, you can validate that the structure of the XML file is correct but there could be problems with the data that are in the elements. This is a big topic I want to look at some of the features that are part of linked XML that we can use to find out whether we have zero length content or whether I have empty elements. Now I'm in a special file here it's called BigStar Collectibles, MissingXML. And in this Rex card, I have a publish date which as you can see has a beginning and ending tag but it has no content. If I were to read the value out of this element I get a zero links, same with image or I don't know was another special kind of syntax you can use an XML when you don't have any content. And it's just this open tag, no close tag. So this is considered to be an empty element. We're…

Contents