I am unable to get values from xml while looping, i want to get values of each and every element inside HostedService. For e.g. service name, Url etc.
Below is my code
XDocument doc;
using (Stream input = System.IO.File.OpenRead(@"D:\Test.xml"))
{
doc = XDocument.Load(input);
foreach (var events in doc.Root.Descendants("HostedServices")) // loop through all events
{
}
}
XML example:
<HostedServices xmlns="http://ift.tt/SuYAcA"xmlns:i="http://ift.tt/ra1lAU">
<HostedService>
<Url>http://ift.tt/1yd8w0I;
<ServiceName>sharepoint2013vm</ServiceName>
<HostedServiceProperties>
<Description i:nil="true" />
<Location>East Asia</Location>
<Label>c2hhcmVwb2ludDIwMTN2bQ==</Label>
<Status>Created</Status>
<DateCreated>2015-01-13T03:42:21Z</DateCreated>
<DateLastModified>2015-01-13T03:42:46Z</DateLastModified>
<ExtendedProperties>
<ExtendedProperty>
<Name>ResourceGroup</Name>
<Value>sharepoint2013vm</Value>
</ExtendedProperty>
<ExtendedProperty>
<Name>ResourceLocation</Name>
<Value>East Asia</Value>
</ExtendedProperty>
</ExtendedProperties>
</HostedServiceProperties>
</HostedService>
<HostedService>
</HostedService>
</HostedServices>
No comments:
Post a Comment