/// <summary>
        /// 在容器末尾增加一个文本节点
        /// </summary>
        /// <param name="modifier">DOM 结构修改器</param>
        /// <param name="container">要添加节点的容器</param>
        /// <param name="htmlText">HTML文本</param>
        /// <returns>添加的文本节点</returns>
        public static IHtmlTextNode AddTextNode( this IHtmlDomModifier modifier, IHtmlContainer container, string htmlText )
        {
            if ( modifier == null )
            throw new ArgumentNullException( "modifier" );

              if ( container == null )
            throw new ArgumentNullException( "container" );

              if ( htmlText == null )
            throw new ArgumentNullException( "htmlText" );

              lock ( container.SyncRoot )
              {
            return modifier.AddTextNode( container, container.Nodes().Count(), htmlText );
              }
        }
 /// <summary>
 /// Adds text nodes to a <see cref="T:System.Xml.XmlNode" />
 /// </summary>
 /// <param name=nNode"><see cref="T:System.Xml.XmlNode" /></param>
 /// <param name="name">Text Node Name</param>
 /// <param name="value">Text Node Values</param>
 public static void AddTextNodes(this XmlNode node, String name, IList<String> values)
 {
     if (node != null && !String.IsNullOrEmpty(name) && node.OwnerDocument != null && values != null && values.Count > 0)
     {
         foreach (String value in values)
         {
             node.AddTextNode(name, value);
         }
     }
 }
Example #3
0
 public static IHtmlTextNode Add( this IHtmlContainer container, XText text )
 {
   return container.AddTextNode( HtmlEncoding.HtmlEncode( text.Value ) );
 }