Esempio n. 1
0
        /// <summary>
        /// Includes the remote resource as a text document.
        /// </summary>
        protected virtual void IncludeAsText()
        {
            var uri = GetAbsoluteHref();
            var txt = IOTextReader.Create(IO, uri, Properties.Encoding).ReadToEnd();

            if (txt != null)
            {
                var text = new XText(txt);
                Element.AddBeforeSelf(txt);
                Element.Remove();

                PostInsertText(text);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Includes the remote resource as an XML document.
        /// </summary>
        protected virtual void IncludeAsXml()
        {
            var uri = GetAbsoluteHref();
            var xml = XDocument.Load(IOXmlReader.Create(IO, uri, Properties.Accept));

            if (xml != null)
            {
                // annotate element and replace self in graph
                var element = new XElement(xml.Root);
                element.SetBaseUri(xml.BaseUri != "" ? xml.BaseUri : uri.ToString());
                Element.AddBeforeSelf(element);
                Element.Remove();

                PostInsertXml(element);
            }
        }