Can we read values using xpath for complex xml file>???
Consider the below xml file (copied at the end of question). I want to read
PatchFile
tag information using xpath.
But when I used below expression it gives me result as null,
XmlDocument doc = new XmlDocument();
doc.Load(@"E:\xmls\p_apsb11-16.xml");
XmlElement root = doc.DocumentElement;
XmlNodeList swupdatelist = root.SelectNodes("/Bulletin");
If I used * instead of giving name then it will give me proper result.
e.g. string Xpath_Expression=
root.SelectNodes("/*/*[4]/*/*/*");
If I used Tag name in xpath expression for simple xml file it gives me proper result. Please let me know if you have adea. How can we use tag name instead of giving * in xpath expression.
I have copied the required Xml below:-
<Bulletin vendor="Adobe" id="APSB11-16" firstReleaseDate="6/29/2011" lastRevisionDate="6/29/2011" version="1.0" severity="Critical" xmlns="Resource.xsd">
<Description>Security updates available for Adobe Reader and Acrobat</Description>
<Summary>For users of Adobe Reader X (10.0.1) for Windows and Macintosh, Adobe has made available the update, Adobe Reader 9.4.4.</Summary>
<ProviderReferences>
<ProviderReference culture="en">
<URL>http://www.adobe.com/support/security/bulletins/apsb11-16.html</URL>
</ProviderReference>
</ProviderReferences>
<SoftwareUpdateGroups>
<SoftwareUpdateGroup id="9215ff71-38c0-416a-b89a-fe3474160f41">
<SoftwareUpdates>
<SoftwareUpdate culture="en">
<PatchFiles>
<PatchFile id="1">
<Name>AdbeRdr830_en_US.msi</Name>
<Description>Adobe Reader 8.3 update - multiple languages</Description>
<FileName>AdbeRdr830_en_US.msi</FileName>
<PatchSize>34661</PatchSize>
<DatePublished>6/29/2011</DatePublished>
<DownloadURL>http://ardownload.adobe.com/pub/adobe/reader/win/8.x/8.3.0/en_US/AdbeRdr830_en_US.msi</DownloadURL>
<CommandLine> </CommandLine>
<InstallationType>870171E8-A8B1-4797-ADBD-5C112AD92FFA</InstallationType>
<BatchFileName> </BatchFileName>
<BatchFileURL>http://localhost/downloads/ </BatchFileURL>
<InventoryRule><![CDATA[</InventoryRule>
<IsApplicableRule><![CDATA[</IsApplicableRule>
<RebootRequired> </RebootRequired>
<Supercedence>
<SupercededFiles>
<SupercededFile>
<BulletinId> </BulletinId>
<UpdateName> </UpdateName>
</SupercededFile>
</SupercededFiles>
</Supercedence>
<PreRequisite GroupID="1">
<Resource>
<Name>Adobe Reader 8.0.0 - English</Name>
<ResourceType>SR</ResourceType>
<ProductName>Office</ProductName>
<InventoryRuleXml> </InventoryRuleXml>
</Resource>
<Resource>
<Name>Adobe Reader 8.0.0 Gold - English</Name>
<ResourceType>SP</ResourceType>
<ProductName>Office</ProductName>
<InventoryRuleXml> </InventoryRuleXml>
</Resource>
</PreRequisite>
</PatchFile>
</PatchFiles>
<InfoURL>http://www.adobe.com/support/downloads/detail.jsp?ftpID=5123</InfoURL>
</SoftwareUpdate>
</SoftwareUpdates>
</SoftwareUpdateGroup>
</SoftwareUpdateGroups>
</Bulletin>