0
说,我有这样的XML文件:存储XML的对象
<?xml version="1.0"?>
<catalog>
<title>My book catalog</title>
<link>http://example.com/catalog</link>
<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>
到底它需要得到的对象,我可以使用如下:
xml.title //must return "My book catalog"
xml.link //must return "http://example.com/catalog"
xml.book[0] //is an object with following properties:
//author, title, genre etc...
//i.e., xml.book[0].author must return Gambardella, Matthew
希望没有类似的问题和抱歉,如果有任何,我的坏,我没有找到。另外,如果有任何有关这方面的文件,请特别指出,因为我找不到它。有很多关于xml解析的文档,但在这种情况下没有任何信息。
在此先感谢。
你见过[如何XML映射到C#对象(HTTP:/ /stackoverflow.com/questions/87621/how-do-i-map-xml-to-c-sharp-objects)? – miku 2012-04-13 21:12:54
你是什么意思没有信息的情况下?谷歌C#和序列号 – 2012-04-13 21:12:55
已经找出。将linq to xml与预定义的类一起使用,其中包含适当的属性。如果需要,我可以发布源代码。 – cheshie 2012-04-13 23:55:10