I am working with XML data where i need to search plan id if plan id found i want to copy to new xml file from to i am able to get the specific plan id but it’s getting namespace as well i dont want to keep namespace
below query i tried
xmlDoc.Descendants(“{ns}PlanDefinition”) _
.Where(Function(x) x.Element(“{ns}PlanUpdate”) IsNot NothingAndAlso _
x.Element(“{”).Attribute(“PlanID”) IsNot Nothing AndAlso _
planIdsToSearch.Contains(x.Element(“{}PlanUpdate”).Attribute(“PlanID”).Value)) _
.ToList()
(From xe In xmlDoc.Root.Descendants()
Where xe.Name.LocalName.equals("PlanDefinition")
Let pu = xe.Elements().First()
Where pu.Name.LocalName.Equals("PlanUpdate")
Where pu.Attributes().Any(Function (a) a.Name.LocalName.Equals("PlanID"))
Let pi = pu.Attribute("PlanID").Value
Where planIdsToSearch.Contains(pi)
Select r = xe).toList