score:0
Accepted answer
tbauthor author =
(from c in cdafile.root.elements(ns + "author")
select new tbauthor
{
streetaddressline = c.xgetelement(".//streetaddressline", "default"),
city = c.xgetelement(".//city", "default"),
state = c.xgetelement(".//state", "default"),
postalcode = c.xgetelement(".//postalcode", "default"),
country = "us"
})
.firstordefault();
score:0
streetaddressline = (string)c.element(ns + "assignedauthor").element(ns + "addr") == null ? "" : c.element(ns + "assignedauthor").element(ns + "addr").element(ns + "streetaddressline").value
Source: stackoverflow.com
Related Query
- Select if exist XML Element using LINQ
- Check if XML element exist using LINQ
- get list from xml using linq based on true if there is no true then select false condition tag element in c#
- Reading XML using XDocument & Linq - check if element is NULL?
- C# check an element exists while using LINQ to XML
- How to check if XML contains element when using LINQ to XML?
- How do I clone a xml element using Linq to Xml
- Select more then one node from XML using LINQ
- How to get the value of an XML element using Linq even when empty
- Select Parent XML Elements based on Child element values LINQ C#
- How do I find an XML element by attribute using LINQ to XML?
- Using LINQ I have a list of lists, how do I select all objects that exist in every list?
- Deleting parent element using Linq to XML
- Cannot find xml element using linq query in Portable Class Library
- Using LINQ to select a random XML node
- Select XML element without using Extension method
- C# find xml element matching two element levels using linq
- How do I add a new element to the existing XML file on Windows Phone 7 using LINQ to XML?
- Select descendent nodes and elements from an XML using LINQ
- Preventing duplicate element access when reading an XML using LINQ
- Querying XML with LINQ and using null in place of a particular xml attribute if it does not exist
- Select specific element by using Linq
- Get XML element value using XML to Linq
- Read the XML using Linq and check if the elements exist
- Flatten xml with text and element nodes using LINQ to XML
- using xml parent data in a LINQ select statement
- How to select an id from a xml element with linq
- Read XML using Linq without element names
- LINQ statement to select the element which is deep inside the XML structure
- How to select child nodes at unknown child element location using LINQ
More Query from same tag
- use Linq to process groups of items in a list
- CS1061 'IEnumerable<<anonymous type: x>>' does not contain a definition for dump
- Linq query combine two or three expressions
- Powershell Equivalent of Linq Statement
- When sorting a list by an int field, can you sort 310 to be between 41 and 39?
- C# Linq to Entity Framework multiple unrelated queries
- xelement get same children nodes
- Find data for latest Inserted date using linq in c#, mysql
- Querying XML with LINQ by attribute
- LINQ Aggregate Results in Entityframework Core
- Trying to concatenate LINQ column values, Not sure where the LINQ error is?
- LINQ conditional selection and formatting
- Linq Many to many
- RIA Services - IQueryable Function With Multiple Parameters as Conditions
- C# Multiple Parameter From Single Expression
- IEnumerable<T> evaluation and unit testing
- Lambda expression where column is equal to list items
- Create generic array in VB.NET
- VB.net Add new listview item in listview with Checked True?
- LINQ: How do I select unique rows: max(id) with multiple columns?
- Tracking last visited nodes - C#
- How to select each first byte from bytes array
- String.Where Comparatively Poor Performance
- Linq Group By Key seems to be "expanding" my result set
- Datatable group by with linq in vb.net
- LINQ Aggregate and GroupBy determining correct data
- EntityException occurred in EntityFramework.SqlServer.dll
- IQueryable conditional include
- LINQ Aggregate algorithm explained
- LINQ-query with if-statement