Example #1
0
        /// <summary>
        /// Reads an old xml file and translates into Chart
        /// </summary>
        /// <param name="xml"></param>
        /// <returns></returns>
        public static ChartData[] ReadXml(string xml)
        {
            XmlDocument xd = new XmlDocument();

            xd.LoadXml(xml);

            XmlTranslator xt = new XmlTranslator();

            ChartData[] cds = new ChartData[] {};
            XmlNode     n   = xd.LastChild;
            string      uri = n.NamespaceURI;

            switch (uri)
            {
            case "http://ngl.fysel.ntnu.no/NglXml1.xsd":
                cds = xt.ReadXmlv2(xml);
                break;

            case "":
                cds = xt.ReadXmlv1(xml);
                break;

            default:
                throw new Exception("NameSpace " + uri + " not found");
            }
            return(cds);
        }
 public ChartData[] GetFromXml(string xml)
 {
     return(XmlTranslator.ReadXml(xml));
 }