I'm trying to select an attribute from my root node but i keep getting a null exception on the select part.
What's the correct way of getting the value of my attribute?
The value i am trying to get value of the attribute: SymbolicName
The xml document:
<Bundle xmlns="urn:uiosp-bundle-manifest-2.0" Name="ContactUsPlugin" SymbolicName="ContactUsPlugin" Version="1" InitializedState="Active">
<Activator Type="ContactUsPlugin.Activator" Policy="Immediate" />
<Runtime>
<Assembly Path="bin\ContactUsPlugin.dll" Share="false" />
</Runtime>
<Functionality>
<Controller>About</Controller>
<View>Index</View>
</Functionality>
<Scripts>
<Script version="1">
<Location>E:\Git Projects\Kapsters\Plugins\ContactUsPlugin\Sql\Sql1.txt</Location>
</Script>
<Script version="2">
<Location>E:\Git Projects\Kapsters\Plugins\ContactUsPlugin\Sql\Sql1.txt</Location>
</Script>
</Scripts>
</Bundle>
I tried:
string widgetCodeName =
(from db in ManifestDocument.Elements() select db.Attribute("SymbolicName").Value).First();
string widgetCodeName =
(from db in ManifestDocument.Descendants() select db.Element("Bundle").Attribute("SymbolicName").Value).First();
string widgetCodeName =
(from db in ManifestDocument.Element("Bundle").Attributes() where db.Name == "SymbolicName" select db.Value).First();