2
Reply

Parsing an XMl File

ramesh margapuri

ramesh margapuri

Jan 7 2011 12:30 PM
8.7k
I need to parse an xml File in C#...The File will look some thing like this....
- <book>
 
<rank>1</rank>
 
<list_name>Chapter Books</list_name>
 
<bestsellers_date>2010-12-26</bestsellers_date>
 
<published_date>2011-01-09</published_date>
 
<weeks_on_list>11</weeks_on_list>
 
<rank_last_week>0</rank_last_week>
 
<asterisk>0</asterisk>
 
<dagger>0</dagger>
- <book_details>
- <book_detail>
 
<title>THE LOST HERO</title>
 
<description>A return to Camp Half-Blood and semi-divine characters old and new.</description>
 
<contributor>by Rick Riordan</contributor>
 
<author>Rick Riordan</author>
 
<contributor_note />
 
<price>18.99</price>
 
<age_group>Ages 10 and up</age_group>
 
<publisher>Disney-Hyperion</publisher>
 
</book_detail>
 
</book_details>
- <isbns>
- <isbn>
 
<isbn13>9781423113393</isbn13>
 
<isbn10>142311339X</isbn10>
 
</isbn>
 
</isbns>
- <reviews>
- <review>
 
<book_review_link />
 
<first_chapter_link />
 
<sunday_review_link />
 
<article_chapter_link>http://artsbeat.blogs.nytimes.com/2010/06/21/the-world-of-percy-jackson-lives-on-in-the-lost-hero/</article_chapter_link>
 
</review>
 
</reviews>
 
</book>
- <book>
 
<rank>2</rank>
 
<list_name>Chapter Books</list_name>
 
<bestsellers_date>2010-12-26</bestsellers_date>
 
<published_date>2011-01-09</published_date>
 
<weeks_on_list>2</weeks_on_list>
 
<rank_last_week>0</rank_last_week>
 
<asterisk>0</asterisk>
 
<dagger>0</dagger>
- <book_details>
- <book_detail>
 
<title>THE GIFT</title>
 
<description>A sister and brother flex their new powers; a Witch and Wizard book.</description>
 
<contributor>by James Patterson and Ned Rust</contributor>
 
<author>James Patterson and Ned Rust</author>
 
<contributor_note />
 
<price>17.99</price>
 
<age_group>Ages 10 and up</age_group>
 
<publisher>Little, Brown</publisher>
 
</book_detail>
 
</book_details>
- <isbns>
- <isbn>
 
<isbn13>9780316036252</isbn13>
 
<isbn10>0316036250</isbn10>
 
</isbn>
- <isbn>
 
<isbn13>9780316122214</isbn13>
 
<isbn10>0316122211</isbn10>
 
</isbn>
 
</isbns>
- <reviews>
- <review>
 
<book_review_link />
 
<first_chapter_link />
 
<sunday_review_link />
 
<article_chapter_link />
 
</review>
 
</reviews>
 
</book>

The data between tags book is one record. Now the second record contains two ISBN13 & two ISBn10's so such kind of data should be populated as 2 records in the table(with everything same but different ISBN10's & ISBN13's) Thanks in advance

Answers (2)