A simple dynamic library implemented in C# 4.0 to deal with XML structure

https://github.com/cardinals/XmlToObjectParser

A simple dynamic library implemented in C# 4.0 to deal with XML structure Assume the following XML sample: _sampleXml = @"<?xml version=""1.0"" encoding=""ISO-8859-1""?> <catalog> <cd country=""USA""> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <price>10.90</price> </cd> <cd country=""UK""> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <price>10.0</price> </cd> <cd country=""USA""> <title>Greatest Hits</title> <artist>Dolly Parton</artist> <price>9.90</price> </cd> </catalog>"; With XmlToObjectParser is possible to traversal this XML like this: var numberOfCDsinCatalog = catalog.catalog.cd.Count; //Results in the number Three var titleFromUKCD = catalog.catalog.cd[1].title; // "Hide your heart" For more details take a look at the documentation on the Wiki: https://github.com/tucaz/XmlToObjectParser/wiki/Getting-Started *Special thanks to @MemphisBR for reviewing the code
原文地址:https://www.cnblogs.com/Jeely/p/11731846.html