//internal virtual void MarkXhtmlElement() //{ // this.MarkXhtmlElement(null); //} /// <summary> /// 根据当前节点的特性来设置该节点 /// </summary> internal virtual void MarkXhtmlElement(PageXmlDocument pageDoc) { this.PageXmlDocument = pageDoc; this.TagCreator(); #region if DEBUG, 辩别生成效果 #if DEBUG //为了辩别生成效果,在Debug时节点加入相关的节点名字 //string eleName = this.LocalName; //PropertyInfo pinfo = this.GetType().GetProperty("SnipPartType"); //if (pinfo != null) //{ // eleName = eleName + "_" + pinfo.GetValue(this, null); //} //if (this._XhtmlElement != null && !(this._XhtmlElement is XhtmlText) && !(this._XhtmlElement is XhtmlCData) && !(this._XhtmlElement is XhtmlComment)) //{ // this._XhtmlElement.SetAttribute("name", eleName); //} #endif #endregion foreach (XmlNode node in this.ChildNodes) { if (node.NodeType != XmlNodeType.Element) { continue; } if (node is ToHtmlXmlElement) { if (node is SnipXmlElement) { SnipXmlElement snip = (SnipXmlElement)node; if (!snip.HasSnip)///如果页面片节点里面并不含有页面片的话,节约效率,就不用再往下遍历 { continue; } } ToHtmlXmlElement htmlNode = (ToHtmlXmlElement)node; htmlNode.PageXmlDocument = this.PageXmlDocument; htmlNode.ParentXhtmlElement = this.SetSubNode(); htmlNode.ToHtml(); } } this._isAlreadyToHtml = true; }
public override XmlElement CreateElement(string prefix, string localName, string namespaceURI) { switch (localName) { case "rect": // modify by lukan, 2008年6月19日10时55分 { SnipRectXmlElement ele = new SnipRectXmlElement(this); return(ele); } case "snip": { SnipXmlElement ele = new SnipXmlElement(this); return(ele); } case "parts": // modify by lukan, 2008年6月19日10时55分 { SnipPartsXmlElement ele = new SnipPartsXmlElement(this); return(ele); } case "part": { SnipPartXmlElement ele = new SnipPartXmlElement(this); return(ele); } case "rects": { SnipRectsXmlElement ele = new SnipRectsXmlElement(this); return(ele); } case "backImage": { AnyXmlElement ele = new AnyXmlElement("backImage", this); return(ele); } default: return(base.CreateElement(prefix, localName, namespaceURI)); } }
public SnipXmlElement CreateSnip(string snipId) { SnipXmlElement ele = new SnipXmlElement(this); ele.Id = snipId; ele.SnipName = ""; ele.Title = ""; ele.Css = ""; ele.HasSnip = false;; ele.SnipType = PageSnipType.General; ele.X = 0; ele.Y = 0; ele.Width = "500px"; ele.Height = "0px"; ele.IsLocked = false; ele.IsSelected = false; XmlElement _partsEle = CreateElement("parts"); ele.AppendChild(_partsEle); return(ele); }
public SnipXmlElement GetKeyListSnip() { SnipXmlElement snipKeyElement = this.SelectSingleNode("//part[@type='ListBox' and @sequenceType='AutoKeyWord']").ParentNode.ParentNode.ParentNode as SnipXmlElement; return(snipKeyElement); }
/// <summary> /// 根据当前节点的特性来设置该节点 /// </summary> protected virtual void MarkXhtmlElement(PageSection pageSection) { switch (pageSection) { case PageSection.MainPage: { _XhtmlElement = new XhtmlSection(); string tmpltFullFile = this.ToHtmlHelper.TmpltRelativeUrl; XhtmlElement tag = _XhtmlElement.CreateXhtmlCommentShtml (tmpltFullFile + this.SdsiteElement.TmpltId + Utility.Const.ShtmlFileExt); _XhtmlElement.AppendChild(tag); this._isAlreadyToMainPageHtml = true; break; } case PageSection.Head: { _HeadXhtmlElement = new XhtmlSection(); #region Title XhtmlTagElement title = _HeadXhtmlElement.CreateXhtmlTitle(); title.InnerText = this.Title; _HeadXhtmlElement.AppendChild(title); #endregion #region keywords XhtmlAtts.Name name; StringBuilder sb; XhtmlAtts.Content content; if (!(this.PageKeywords == null)) { name = new XhtmlAtts.Name("keywords"); sb = new StringBuilder(); foreach (string str in this.PageKeywords) { sb.Append(str).Append(','); } content = new XhtmlAtts.Content(sb.ToString().TrimEnd(',')); XhtmlTagElement keyword = _HeadXhtmlElement.CreateXhtmlMeta(name, content); _HeadXhtmlElement.AppendChild(keyword); } #endregion #region description name = new XhtmlAtts.Name("description"); content = new XhtmlAtts.Content(this.PageSummary); XhtmlTagElement description = _HeadXhtmlElement.CreateXhtmlMeta(name, content); _HeadXhtmlElement.AppendChild(description); #endregion this._isAlreadyToHeadHtml = true; break; } case PageSection.Content: { SdsiteXmlDocument doc = (SdsiteXmlDocument)this.SdsiteElement.OwnerAnyDocument; string tmpltId = this.SdsiteElement.TmpltId; TmpltXmlDocument tmplt = doc.GetTmpltDocumentById(this.SdsiteElement.TmpltId); XhtmlSection ele = (XhtmlSection)tmplt.GetContentSnipEle().XhtmlElement; if (ele == null) { SnipXmlElement snip = tmplt.GetContentSnipEle(); snip.MarkXhtmlElement(this); ele = (XhtmlSection)tmplt.GetContentSnipEle().XhtmlElement; } _ContentXhtmlElement = ele; this._isAlreadyToContentHtml = true; break; } case PageSection.None: default: break; } }