Exemplo n.º 1
0
        public static SvgElement LoadFromXML(XmlDocument doc, XmlElement el)
        {
            if (el == null)
            {
                foreach (XmlNode xmlNode in doc.ChildNodes)
                {
                    if (xmlNode.GetType() == typeof(XmlElement))
                    {
                        el = (XmlElement)xmlNode;
                        break;
                    }
                }
            }
            SvgElement result;

            if (el == null)
            {
                result = null;
            }
            else
            {
                if (SvgFactory._elementNameDictionary == null)
                {
                    SvgFactory.BuildElementNameDictionary();
                }
                Type       type       = (Type)SvgFactory._elementNameDictionary[el.Name];
                SvgElement svgElement = (SvgElement)type.GetConstructor(new Type[0]).Invoke(new object[0]);
                SvgFactory.RecLoadFromXML(svgElement, doc, el);
                result = svgElement;
            }
            return(result);
        }
Exemplo n.º 2
0
        public void TestSvgFactory_BuildElementNameDictionary()
        {
            var dict = SvgFactory.BuildElementNameDictionary();

            Assert.NotNull(dict);
            Assert.That(dict, Has.Count.GreaterThanOrEqualTo(25));
            Assert.IsTrue(dict.ContainsKey("svg"));
        }