1
Answer

read file using xmlreader and xpath

Photo of Priya Pated

Priya Pated

14y
10.2k
1

I am reading a XML file ,

XmlDocument objectTemporaryDocument = new XmlDocument();

objectTemporaryDocument.Load(

stringPathOfFile);

XmlNodeList objContentXmlNode = objectContentDocument.SelectNodes("/Root/Section");
foreach (XmlNode objInternalPages in objContentXmlNode)
{
XmlNode xmlNodeSettings = objInternalPages.SelectSingleNode("SubSection");
if (xmlNodeSettings != null)
{
stringModuleOverviewAlignment = xmlNodeSettings.Attributes["AttributeVal1"].Value;
stringGlobalDate = xmlNodeSettings.Attributes["AttributeVal2"].Value;
}
}

Which is giving required values and results..,But xml document is very big in size
so taking more time.

Can anyone tell me how to achive this using XPATH and XmlReader

thanks in advance
Priya

Answers (1)