Vote count:
0
I have written this code in c# to read an xml file (I will provide a snippet at the bottom)
Code:
string filePath = "movies.xml";
movieDataSet.ReadXml(filePath, XmlReadMode.InferTypedSchema);
movieList.DataSource = movieDataSet;
movieList.DataMember = "movie";
XML File:
<movielist>
<movie>
<title>Adventures of Casanova </title>
<year>1948</year>
<length>83 min</length>
<certification>Approved</certification>
<director>Roberto Gavaldn</director>
<rating>1</rating>
<genre>Action</genre>
<genre>Adventure</genre>
<genre>History</genre>
<genre>Romance</genre>
<genre>War</genre>
<actor>Arturo de C rdova</actor>
<actor>Lucille Bremer</actor>
<actor>Turhan Bey</actor>
<actor>John Sutton</actor>
<actor>George Tobias</actor>
</movie>
<movie>
<title>Amazon Quest </title>
<year>1954</year>
<length>75 min</length>
<director>Steve Sekely</director>
<rating>7</rating>
<genre>Action</genre>
<genre>Drama</genre>
<actor>Tom Neal</actor>
<actor>Carole Mathews</actor>
<actor>Carole Donne</actor>
<actor>Don Zelaya</actor>
<actor>Ralph Graves</actor>
</movie>
<movie>
<title>American Ninja 3: Blood Hunt </title>
<year>1989</year>
<length>89 min</length>
<certification>R</certification>
<director>Cedric Sundstrom</director>
<rating>7</rating>
<genre>Action</genre>
<genre>Drama</genre>
<actor>David Bradley</actor>
<actor>Steve James</actor>
<actor>Marjoe Gortner</actor>
<actor>Michele B. Chan</actor>
<actor>Yehuda Efroni</actor>
</movie>
</movielist>
I noticed the only tags being read are title, year, length, certification, director, rating which occur just once in within a movie. What could I be doing wrong? I have tried different XmlReadMode's and InferTypedSchema seems to be the one closest to solving my problem of adding the xml data to a dataset
asked 2 mins ago
Dataset.readxml() only adds tags that appear once
Aucun commentaire:
Enregistrer un commentaire