Exemplo n.º 1
0
 /// <summary>
 /// 当文档碎片被分配到文档上时被调用,用于释放碎片。
 /// </summary>
 /// <param name="fragment"></param>
 internal void Allocated(DomFragment fragment)
 {
     lock ( SyncRoot )
     {
         _fragments.Remove(fragment);
     }
 }
Exemplo n.º 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 );
              }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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 ) );
 }
Exemplo n.º 5
0
 /// <summary>
 /// 当文档碎片被分配到文档上时被调用,用于释放碎片。
 /// </summary>
 /// <param name="fragment"></param>
 internal void Allocated( DomFragment fragment )
 {
     lock ( SyncRoot )
       {
     _fragments.Remove( fragment );
       }
 }
Exemplo n.º 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));
 }