Salut a tous, J'aimerait savoir comment dans un projet C# Je pourrai faire :
Sélectionner un Item par son ID : par exemple sélectionner book where id = "bk102"
et retourne les caractéristique de la manière suivante;
en C#
Exemple de fichier XML fournis par Microsoft "books.xml" :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 Main{ XmlTextReader reader = new XmlTextReader("books.xml"); // Code qui permet de récupérer les item. string Auteur = /* books where id = kb102.author*/; string Titre = /* books where id = kb102.title*/; }
Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 <?xml version="1.0"?> <catalog> <book id="bk101"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>An in-depth look at creating applications with XML.</description> </book> <book id="bk102"> <author>Ralls, Kim</author> <title>Midnight Rain</title> <genre>Fantasy</genre> <price>5.95</price> <publish_date>2000-12-16</publish_date> <description>A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.</description> </book> ... </catalog>
Partager