public XmlDocument GetCarsXML() { CarsJSONAdaptee personJSONAdapte = new CarsJSONAdaptee(); string cars = personJSONAdapte.GetCarsJSON(); XmlDocument x = JsonConvert.DeserializeXmlNode(cars, "ListOfCars", true); return(x); }
static void Main(string[] args) { CarsJSONAdaptee json = new CarsJSONAdaptee(); CarsXMLAdapter xml = new CarsXMLAdapter(); Program p = new Program(json); Console.WriteLine("json\n"); Console.WriteLine(p.json.GetCarsJSON().ToString()); p = new Program(xml); Console.WriteLine("\nxml\n"); Console.WriteLine(p.xml.GetCarsXML().InnerXml); Console.ReadKey(); }
public Program(CarsJSONAdaptee json) { this.json = json; }