Exemple #1
0
 /// <summary>
 /// 当文档碎片被分配到文档上时被调用,用于释放碎片。
 /// </summary>
 /// <param name="fragment"></param>
 internal void Allocated(DomFragment fragment)
 {
     lock ( SyncRoot )
     {
         _fragments.Remove(fragment);
     }
 }
Exemple #2
0
        /// <summary>
        /// 解析 HTML 文本到指定的文档碎片对象
        /// </summary>
        /// <param name="html">要解析的 HTML 文本</param>
        /// <param name="fragment">要处理的文本碎片</param>
        public virtual void ParseToFragment( string html, DomFragment fragment )
        {
            if ( string.IsNullOrEmpty( html ) )
            return;

              lock ( SyncRoot )
              {

            Initialize();

            SetHtmlSpecification( fragment.Document.HtmlSpecification );

            ContainerStack.Push( fragment );

            ParseInternal( html );

            fragment.ContentFragment = new HtmlContentFragment( Reader, 0, Reader.HtmlText.Length );
              }
        }
Exemple #3
0
        /// <summary>
        /// 解析 HTML 文本到指定的文档碎片对象
        /// </summary>
        /// <param name="html">要解析的 HTML 文本</param>
        /// <param name="fragment">要处理的文本碎片</param>
        public virtual void ParseToFragment(string html, DomFragment fragment)
        {
            if (string.IsNullOrEmpty(html))
            {
                return;
            }

            lock ( SyncRoot )
            {
                Initialize();

                SetHtmlSpecification(fragment.Document.HtmlSpecification);

                ContainerStack.Push(fragment);

                ParseInternal(html);

                fragment.ContentFragment = new HtmlContentFragment(Reader, 0, Reader.HtmlText.Length);
            }
        }
Exemple #4
0
 internal void OnFragmentInto( DomFragment fragment, IHtmlContainer targetContainer, DomNode node )
 {
     OnDomChanged( this, new HtmlDomChangedEventArgs( node, fragment, HtmlDomChangedAction.Remove ) );
       OnDomChanged( this, new HtmlDomChangedEventArgs( node, targetContainer, HtmlDomChangedAction.Add ) );
 }
 /// <summary>
 /// 当文档碎片被分配到文档上时被调用,用于释放碎片。
 /// </summary>
 /// <param name="fragment"></param>
 internal void Allocated( DomFragment fragment )
 {
     lock ( SyncRoot )
       {
     _fragments.Remove( fragment );
       }
 }
Exemple #6
0
 internal void OnFragmentInto(DomFragment fragment, IHtmlContainer targetContainer, DomNode node)
 {
     OnDomChanged(this, new HtmlDomChangedEventArgs(node, fragment, HtmlDomChangedAction.Remove));
     OnDomChanged(this, new HtmlDomChangedEventArgs(node, targetContainer, HtmlDomChangedAction.Add));
 }