// 在当前集合中每个元素的DOM位置后面插入新元素 // 参见 MarcQuery::insertAfter() 函数的注释 // 最后返回当前集合 /// <summary> /// 在当前集合中每个元素的 DOM 位置后面插入新元素,新元素由指定的源字符串构造 /// </summary> /// <param name="strSourceText">源字符串</param> /// <returns>当前集合</returns> public MarcNodeList after(string strSourceText) { if (this.count == 0 || string.IsNullOrEmpty(strSourceText)) { return(this); } if (this[0].NodeType == NodeType.None) { throw new ArgumentException("不允许在 None 对象的后面添加任何对象"); } if (this[0].NodeType == NodeType.Record) { throw new ArgumentException("不允许在 记录 对象的后面添加任何对象"); } MarcNodeList source_nodes = null; string strLeading = ""; if (this[0].NodeType == NodeType.Field) { source_nodes = MarcQuery.createFields(strSourceText); } else { source_nodes = MarcQuery.createSubfields(strSourceText, out strLeading); // leading要追加到目标集合的最后一个元素的Content末尾 if (string.IsNullOrEmpty(strLeading) == false) { this.last()[0].Content += strLeading; } } MarcQuery.insertAfter(source_nodes, this); return(this); }
// 在当前集合中每个元素的DOM位置后面插入源集合内的元素 // 参见 MarcQuery::insertAfter() 函数的注释 // 最后返回当前集合 /// <summary> /// 在当前集合中每个元素的 DOM 位置后面插入指定的源集合内的元素 /// </summary> /// <param name="source_nodes">源集合</param> /// <returns>当前集合</returns> public MarcNodeList after(MarcNodeList source_nodes) { MarcQuery.insertAfter(source_nodes, this); return(this); }
// 把当前集合中的每个元素插入到目标集合的每个元素的DOM位置后面 // 参见 MarcQuery::insertAfter() 函数的注释 // 最后返回当前集合 /// <summary> /// 将当前集合中的每个元素插入到指定的目标集合的每个元素的 DOM 位置后面 /// </summary> /// <param name="target_nodes">目标集合</param> /// <returns>当前集合</returns> public MarcNodeList insertAfter(MarcNodeList target_nodes) { MarcQuery.insertAfter(this, target_nodes); return(this); }