se vi occorre recuperare un valore da un file xml ecco una routine c#
public string GetDecodifica(string Value, string XMLFilePathName, string XMLFileName, string Nodo )
{
// istanzia XPath per navigare nei nodi del file xml
XPathDocument xdoc = new XPathDocument(XMLFilePathName + XMLFileName);
XPathNavigator xnav = ((IXPathNavigable)xdoc).CreateNavigator();
XPathNodeIterator xiter = xnav.Select(Nodo);
// Recupera da file xml il valore cercato
while(xiter.MoveNext())
{
XPathNodeIterator xiterFields = xiter.Current.SelectDescendants(XPathNodeType.Element,false);
while(xiterFields.MoveNext())
{
string cValue = Value;
if(xiterFields.Current.Name==cValue) return xiterFields.Current.Value;
}
}
return null;
}
...dopo parecchio silenzio....
se può servire a qualcuno ecco una routine c# che "svolge" un dataset di qualsiasi dimensione e ne scrive il contenuto in un file testuale.
public void WriteToTxt(DataSet myDataset, string pathFileName, string fileNameStartWith)
{
string file = String.Format("{0}{1}{2}.txt", pathFileName, fileNameStartWith, DateTime.Now.ToString("dd-MM-yyyy_HH.mm.ss"));
TextWriter tw = File.CreateText(file);
foreach (DataTable dt in myDataset.Tables)
{
foreach (DataRow dr in dt.Rows)
{
for (int i=0; i<=(dr.ItemArray.Length-1); i++) tw.Write(dr[i].ToString());
tw.WriteLine();
}
}
tw.Close();
}