I have to inventory about 400 reports, and what I need to do is pull all the sql out of the reports. I’m able to XmlDocument load the results and navigate the information in VS and find the information i’m looking for.
In each report I have to click Results View
I have to drill down results view for the following Elements.
{Element, Name="Report"}
{Element, Name="DataSet"}
{Element, Name="Query"}
{Element, Name="Command Text"}
I’m trying to get to the elemental Command Text, but i’m unsure of how to enurmate or access that level. here is the code i am using:
string[] Fil_Info = Directory.GetFiles(dir);
foreach (string file in Fil_Info)
{
XmlDocument doc = new XmlDocument();
doc.Load(file);
//Console.WriteLine(doc.Value.ToString());
XmlAttributeCollection attrColl =doc.DocumentElement.Attributes;
foreach (XmlAttribute xmlAtt in attrColl)
{
XmlAttributeCollection attrColl2 = xmlAtt.Attributes;
foreach (XmlAttribute xmlAtt2 in attrColl2)
{
}
}
}
I don’t really know what you’re after and I haven’t seen your XML’s structure so I’m taking a wild guess and this is probably not optimal/functional but hey what’s the fun if you don’t need to tweak it right?
if you want more help please, pretty please post a example of what the original XML looks like 🙂