Exemple #1
0
        public XmlDocument GetCarsXML()
        {
            CarsJSONAdaptee personJSONAdapte = new CarsJSONAdaptee();
            string          cars             = personJSONAdapte.GetCarsJSON();
            XmlDocument     x = JsonConvert.DeserializeXmlNode(cars, "ListOfCars", true);

            return(x);
        }
Exemple #2
0
        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();
        }
Exemple #3
0
 public Program(CarsJSONAdaptee json)
 {
     this.json = json;
 }