Hi Guys,
I am Fairly new to Linq and I am trying to write a simple query to return the error messages within my xml file.
<?xml version="1.0" encoding="utf-8"?>
<Error xmlns="urn:xxxxx">
The following errors were detected:
<Message>Internal Error</Message></Error>
The following works and returns the error message:
Dim loaded As XDocument = XDocument.Parse(strReturn)
Dim ns As XNamespace = "urn:xxxxx"
Dim errors = From err In loaded.Descendants(ns + "Error") _
Select err.Elements(ns + "Message").Value
but the following does not and returns no results:
Imports <xmlns="urn:xxxxx">
Dim loaded As XDocument = XDocument.Parse(strReturn)
Dim errors = From err In loaded.Descendants.<Error> _
Select err.Elements.<Message>.Value
I am just trying to get a better understand of Linq but can someone tell me why the later does not work as should they both not return the same result?
Thanks in advance