using System.Collections;
using System.Collections.Generic;
using System.Data.DataSetExtensions;
using System.Text.RegularExpressions;
public static void Main()
XDocument doc = XDocument.Parse(input);
.Where(x=> (!x.HasElements &&((string)x.Value).Trim() == "Value1")
|| (x.Attribute("value") != null && x.Attribute("value").Value == "Value1"))