Esempio n. 1
0
        /// <summary>
        /// Reconstructs an <see cref="OpenXmlElement"/> object from the specified XML.
        /// </summary>
        /// <param name="outerXml">The XML which defines the element.</param>
        /// <returns>
        /// An <see cref="OpenXmlElement"/> represented by the specified XML.
        /// Or a <see cref="OpenXmlUnknownElement"/> if the element is unknown.
        /// </returns>
        public OpenXmlElement Reconstruct(string outerXml)
        {
            var ns      = outerXmlExtractor.ExtractNamespace(outerXml);
            var tagName = outerXmlExtractor.ExtractTagName(outerXml);

            var type = GetTypeOfTag(ns, tagName);

            if (type == null)
            {
                return(new OpenXmlUnknownElement("unknown"));
            }

            var element = reflectionBuilder.ConstructType(type, outerXml);

            return(element);
        }