示例#1
0
        /// <summary>
        /// Load FixedPage element into a DOM tree to initialize a FixedPageContentExtractor.
        /// The content extractor will then be used to incrementally return the content of the fixed page.
        /// </summary>
        private IndexingContentUnit ProcessFixedPage()
        {
            // Reader is positioned on the start-tag for a FixedPage element.
            Debug.Assert(String.CompareOrdinal(_xamlReader.LocalName, _fixedPageName) == 0);

            // A FixedPage nested in a FixedPage is invalid.
            // XmlException gets handled inside this class (see GetChunk).
            if (_filterState == FilterState.FindNextFlowUnit)
            {
                throw new XmlException(SR.Get(SRID.XamlFilterNestedFixedPage));
            }

            // Create a DOM for the current FixedPage.
            string      fixedPageMarkup = _xamlReader.ReadOuterXml();
            XmlDocument fixedPageTree   = new XmlDocument();

            fixedPageTree.LoadXml(fixedPageMarkup);

            // Preserve the current language ID
            if (_xamlReader.XmlLang.Length > 0)
            {
                fixedPageTree.DocumentElement.SetAttribute(_xmlLangAttribute, _xamlReader.XmlLang);
            }

            // Initialize a content extractor with this DOM tree.
            _fixedPageContentExtractor = new FixedPageContentExtractor(fixedPageTree.DocumentElement);

            // Save the DOM (to search for flow elements in it once the extractor is done)
            // and switch to extractor mode.
            _fixedPageDomTree = fixedPageTree;
            _filterState      = FilterState.UseContentExtractor;

            // Have NextContentUnit look for the appropriate unit in the new mode.
            return(null);
        }
示例#2
0
        /// <summary> 
        /// Load FixedPage element into a DOM tree to initialize a FixedPageContentExtractor.
        /// The content extractor will then be used to incrementally return the content of the fixed page.
        /// </summary>
        private IndexingContentUnit ProcessFixedPage() 
        {
            // Reader is positioned on the start-tag for a FixedPage element. 
            Debug.Assert(String.CompareOrdinal(_xamlReader.LocalName, _fixedPageName) == 0); 

            // A FixedPage nested in a FixedPage is invalid. 
            // XmlException gets handled inside this class (see GetChunk).
            if (_filterState == FilterState.FindNextFlowUnit)
            {
                throw new XmlException(SR.Get(SRID.XamlFilterNestedFixedPage)); 
            }
 
            // Create a DOM for the current FixedPage. 
            string fixedPageMarkup = _xamlReader.ReadOuterXml();
            XmlDocument fixedPageTree = new XmlDocument(); 
            fixedPageTree.LoadXml(fixedPageMarkup);

            // Preserve the current language ID
            if (_xamlReader.XmlLang.Length > 0) 
            {
                fixedPageTree.DocumentElement.SetAttribute(_xmlLangAttribute, _xamlReader.XmlLang); 
            } 

            // Initialize a content extractor with this DOM tree. 
            _fixedPageContentExtractor = new FixedPageContentExtractor(fixedPageTree.DocumentElement);

            // Save the DOM (to search for flow elements in it once the extractor is done)
            // and switch to extractor mode. 
            _fixedPageDomTree = fixedPageTree;
            _filterState = FilterState.UseContentExtractor; 
 
            // Have NextContentUnit look for the appropriate unit in the new mode.
            return null; 
        }