Code pour la lecture d'un fichier XML dans un DataTable

J'ai écrit le morceau de code suivant qui lit dans un fichier xml, et écrit le contenu dans une table de données. Merci de ne PAS vous suggérons d'utiliser LinqToXml que cette option est exclue parce que c'est un héritage de l'application.

            //create the DataTable that will hold the data
            DataTable table = new DataTable("ListOfPersonsWithInfo");


            //open the file using a Stream
            using (Stream stream = new FileStream(fileNameWithAbsolutePath, FileMode.Open, FileAccess.Read))
            {
                //create the table with the appropriate column names
                table.Columns.Add("Name", typeof(String));
                table.Columns.Add("ImagePath", typeof(String));
                table.Columns.Add("Address", typeof(String));

                //use ReadXml to read the XML stream
                table.ReadXml(stream);

                //tried with this overload-option as well but didnt help
                //table.ReadXml(fileNameWithAbsolutePath);

                //return the results
                return table;
            }

, MAIS le retour-table contient des lignes nulles...!!! où que le fichier xml a '3 rangées" et est structuré comme suit (AUCUNE IDÉE de ce qui ne va pas ici?):

<?xml version="1.0" encoding="utf-8"?>
<Details>
    <EachPerson>
        <Name>Jack</Name>
        <ImagePathAndFileName>C:\Users\Public\Pictures\Sample Pictures\Desert.jpg</ImagePathAndFileName>
        <Address>NewYork</Address>
    </EachPerson>
    <EachPerson>
        <Name>Tom</Name>
        <ImagePathAndFileName>C:\Users\Public\Pictures\Sample Pictures\Desert.jpg</ImagePathAndFileName>
        <Address>London</Address>
    </EachPerson>
    <EachPerson>
        <Name>Jill</Name>
        <ImagePathAndFileName>C:\Users\Public\Pictures\Sample Pictures\Desert.jpg</ImagePathAndFileName>
        <Address>Tokyo</Address>
    </EachPerson>
</Details>

OriginalL'auteur MukeshAnAlsoRan | 2012-03-20