/// <summary>
        /// Resolves the XHTML.
        /// </summary>
        /// <param name="formatTextResolver"><see cref="T:TcmTemplating.Helpers.FormatTextResolver" /></param>
        /// <param name="xhtml">Tridion XHTML.</param>
        /// <returns><see cref="T:System.Xml.XPath.XPathNodeIterator" /></returns>
        protected XPathNodeIterator ResolveXHTML(FormatTextResolver formatTextResolver, XPathNodeIterator xhtml)
        {
            using (StringWriterEncoding sw = new StringWriterEncoding())
            {
                using (XmlWriter xw = XmlWriter.Create(sw, TemplateBase.TemplateXmlWriterSettings))
                {
                    xw.WriteStartElement("root");

                    foreach (XPathNavigator node in xhtml)
                    {
                        xw.WriteRaw(node.OuterXml);
                    }

                    xw.WriteEndElement();
                }

                String xml = formatTextResolver.Resolve(sw.ToString());

                XElement parsedXml = XElement.Parse(xml);

                return(parsedXml.CreateNavigator().Select("node()"));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Resolves the XHTML.
        /// </summary>
        /// <param name="formatTextResolver"><see cref="T:TcmTemplating.Helpers.FormatTextResolver" /></param>
        /// <param name="xhtml">Tridion XHTML.</param>
        /// <returns><see cref="T:System.Xml.XPath.XPathNodeIterator" /></returns>
        protected XPathNodeIterator ResolveXHTML(FormatTextResolver formatTextResolver, XPathNodeIterator xhtml)
        {
            using (StringWriterEncoding sw = new StringWriterEncoding())
            {
                using (XmlWriter xw = XmlWriter.Create(sw, TemplateBase.TemplateXmlWriterSettings))
                {
                    xw.WriteStartElement("root");

                    foreach (XPathNavigator node in xhtml)
                        xw.WriteRaw(node.OuterXml);

                    xw.WriteEndElement();
                }

                String xml = formatTextResolver.Resolve(sw.ToString());

                XElement parsedXml = XElement.Parse(xml);

                return parsedXml.CreateNavigator().Select("node()");
            }
        }