本文整理汇总了C#中SageFrame.Templating.xmlparser.XmlTag类的典型用法代码示例。如果您正苦于以下问题:C# XmlTag类的具体用法?C# XmlTag怎么用?C# XmlTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlTag类属于SageFrame.Templating.xmlparser命名空间,在下文中一共展示了XmlTag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GeneratePlaceHolderMarkup
/// <summary>
/// Generates placeholder markup.
/// </summary>
/// <param name="Section">Section node.</param>
/// <returns>Placeholder markup.</returns>
public string GeneratePlaceHolderMarkup(XmlTag Section)
{
foreach (XmlTag tag in Section.LSTChildNodes)
{
}
return "";
}
示例2: ProcessPlaceholder
/// <summary>
/// Obtain place holder.
/// </summary>
/// <param name="placeholder">Object of XmlTag class.</param>
/// <param name="lstWrapper">List of CustomWrapper class.</param>
/// <param name="_Mode">Mode</param>
/// <returns>String format of placeholder markup.</returns>
public static string ProcessPlaceholder(XmlTag placeholder, List<CustomWrapper> lstWrapper, int _Mode)
{
Mode = _Mode;
///1.Check for outer wrappers(skipping for now)
///2.Check for the wrapper="inner,3" attribute, Split the positions and inline styles according to width and mode attribute
StringBuilder sb = new StringBuilder();
foreach (XmlTag pch in placeholder.LSTChildNodes)
{
string[] positions = pch.InnerHtml.Split(',');
int mode = Utils.GetAttributeValueByName(pch, XmlAttributeTypes.MODE) == "" ? 0 : 1;
foreach (CustomWrapper start in lstWrapper)
{
if (start.Type == "placeholder" && Utils.GetAttributeValueByName(pch, XmlAttributeTypes.NAME).ToLower().Equals(start.Start))
{
string style = string.Format("sfBlockwrap {0}", start.Class);
int depth = start.Depth;
for (int i = 1; i <= depth; i++)
{
if (i == 1)
{
style = start.Depth > 1 ? string.Format("sfBlockwrap sfWrap{0}{1}", start.Index, start.Class == "" ? "" : string.Format(" {0}", start.Class)) : string.Format("sfBlockwrap sfWrap{0}{1} clearfix", start.Index, start.Class == "" ? "" : string.Format(" {0}", start.Class)); ;
sb.Append("<div class='" + style + "'>");
}
else
{
style = start.Depth == i ? string.Format("sfBlockwrap sf{0}{1} clearfix", i - 1, start.Class == "" ? "" : string.Format(" {0}", start.Class)) : string.Format("sfBlockwrap sf{0}{1}", i - 1, start.Class == "" ? "" : string.Format(" {0}", start.Class));
sb.Append("<div class='" + style + "'>");
}
}
}
}
List<int> wrapperdepth = new List<int>();
sb.Append(GenerateBlockWrappers(pch, ref wrapperdepth));
switch (mode)
{
case 0:
sb.Append(ParseNormalBlocks(pch, lstWrapper));
break;
case 1:
sb.Append(ParseFixedBlocks(pch, lstWrapper));
break;
}
sb.Append(HtmlBuilder.GenerateBlockWrappersEnd(wrapperdepth));
foreach (CustomWrapper start in lstWrapper)
{
string pchName = Utils.GetAttributeValueByName(pch, XmlAttributeTypes.NAME).ToLower();
if (start.Type == "placeholder" && pchName.Equals(start.End))
{
for (int i = 1; i <= start.Depth; i++)
{
sb.Append("</div>");
}
}
}
}
return sb.ToString();
}
示例3: GetXmlTags
public List<XmlTag> GetXmlTags(string xmlFile, string startParseNode)
{
List<XmlTag> lstSectionNodes = new List<XmlTag>();
XmlDocument doc = XmlHelper.LoadXMLDocument(xmlFile);
XmlNodeList sectionList = doc.SelectNodes(startParseNode);
foreach (XmlNode section in sectionList)
{
XmlTag tag = new XmlTag();
tag.TagName = section.Name;
tag.TagType = GetXmlTagType(section);
tag.ChildNodeCount = GetChildNodeCount(section);
tag.AttributeCount = GetAttributeCount(section);
tag.LSTAttributes = GetAttributesCollection(section);
tag.LSTChildNodes = section.ChildNodes.Count > 0 ? GetChildNodeCollection(section) : new List<XmlTag>();
tag.CompleteTag = BuildCompleteTag(tag);
tag.PchArr = GetPlaceholders(section);
tag.Placeholders = string.Join(",", tag.PchArr);
if (ValidateTagType(tag))
{
lstSectionNodes.Add(tag);
}
}
doc.Save(xmlFile);
return lstSectionNodes;
}
示例4: GeneratePlaceholderStart
/// <summary>
///Obtain starting placeholder.
///1.Check for classes like no-wrap and no-main.
///2.Check for wrap-inner and main-inner classes.
///3.If Wrap-inner is not defined simply create a wrap class and a id from the key.
///4.Check for main inner and other wrappers.
///5.If we are using special markup tags this is the place to begin the markups.
///6.Generate main-inner wrappers if present.
/// </summary>
/// <param name="placeholder">Object of XmlTag class.</param>
/// <returns>String format of placeholder markup.</returns>
public static string GeneratePlaceholderStart(XmlTag placeholder)
{
StringBuilder sb = new StringBuilder();
sb.Append(String.Format("<div id=\"id-{0}\" class=\"sf{1}\">", Utils.GetAttributeValueByName(placeholder, XmlAttributeTypes.NAME), Utils.GetAttributeValueByName(placeholder, XmlAttributeTypes.NAME)));
return sb.ToString();
}
示例5: TagBuilder
public static XmlTag TagBuilder(string tagName, XmlTagTypes type, XmlAttributeTypes attType, string attName, string attValue, string innerHTML)
{
XmlTag tag = new XmlTag();
tag.TagType = type;
tag.TagName = tagName;
tag.LSTAttributes = AddAttributes(attName, attValue, attType);
tag.InnerHtml = innerHTML;
return tag;
}
示例6: IsSpotLight
public static bool IsSpotLight(XmlTag placeholder)
{
string pchName = Utils.GetAttributeValueByName(placeholder, XmlAttributeTypes.NAME);
bool status = false;
if (Utils.CompareStrings(pchName, "spotlight"))
{
status = true;
}
return status;
}
示例7: HasBlock
public static bool HasBlock(Placeholders pch, XmlTag middleBlock)
{
bool status = false;
status = middleBlock.LSTChildNodes.Exists(
delegate(XmlTag tag)
{
return (Utils.CompareStrings(Utils.GetAttributeValueByName(tag, XmlAttributeTypes.NAME), pch));
}
);
return status;
}
示例8: GetAttributeValueByName
public static string GetAttributeValueByName(XmlTag tag, XmlAttributeTypes _type)
{
string value = string.Empty;
string name = _type.ToString();
LayoutAttribute attr = new LayoutAttribute();
attr = tag.LSTAttributes.Find(
delegate(LayoutAttribute attObj)
{
return (Utils.CompareStrings(attObj.Name, name));
}
);
return attr == null ? "" : attr.Value;
}
示例9: GenerateSectionMarkup
/// <summary>
/// Generates section markups.
/// </summary>
/// <param name="section">Section node.</param>
/// <returns>Section markup.</returns>
public string GenerateSectionMarkup(XmlTag section)
{
string markup = "";
if (section.AttributeCount > 0)
{
foreach (LayoutAttribute attr in section.LSTAttributes)
{
switch (attr.Type)
{
case XmlAttributeTypes.NAME:
markup = GetSectionMarkup(attr.Value, section);
break;
case XmlAttributeTypes.TYPE:
break;
case XmlAttributeTypes.SPLIT:
break;
}
}
}
return markup;
}
示例10: IsCustomBlockDefined
public static bool IsCustomBlockDefined(XmlTag placeholder)
{
string activeTemplate = HttpContext.Current.Session["SageFrame.ActiveTemplate"] != null ? HttpContext.Current.Session["SageFrame.ActiveTemplate"].ToString() : "Default";
string pchName = Utils.GetAttributeValueByName(placeholder, XmlAttributeTypes.NAME);
string FilePath = HttpContext.Current.Server.MapPath("~/") + "//" + activeTemplate + "//sections";
bool status = false;
if (Directory.Exists(FilePath))
{
DirectoryInfo dir = new DirectoryInfo(FilePath);
foreach (FileInfo file in dir.GetFiles("*.htm"))
{
if (Utils.CompareStrings(Path.GetFileNameWithoutExtension(file.Name), pchName))
{
status = true;
break;
}
}
}
return status;
}
示例11: GetSectionMarkup
public string GetSectionMarkup(string name, XmlTag section)
{
string html = "";
if (Enum.IsDefined(typeof(SectionTypes), name.ToUpper()))
{
SectionTypes _type = (SectionTypes)Enum.Parse(typeof(SectionTypes), name.ToUpper());
switch (_type)
{
case SectionTypes.TOP:
html = GetTopMarkup(section);
break;
case SectionTypes.MIDDLE:
html = GetMiddleWrapper(section);
break;
case SectionTypes.BOTTOM:
html = GetBottomMarkup(section);
break;
}
}
return html;
}
示例12: CalculateColumnWidth
/// <summary>
/// Calculates the column width for the middle block
/// Takes the ColumnWidth from the Parent Node which applies to right and left
/// However the inline "width" attributes overrides the Parent's colwidth attribute
/// </summary>
/// <param name="section"></param>
/// <param name="_type"></param>
/// <returns></returns>
public static string CalculateColumnWidth(XmlTag section, Placeholders _type)
{
string width = "20";
foreach (XmlTag tag in section.LSTChildNodes)
{
if (Utils.CompareStrings(_type, Utils.GetAttributeValueByName(tag, XmlAttributeTypes.NAME)))
{
int widthIndex = -1;
widthIndex = tag.LSTAttributes.FindIndex(
delegate(LayoutAttribute tagAttr)
{
return (Utils.CompareStrings(tagAttr.Name, XmlAttributeTypes.WIDTH));
}
);
if (widthIndex > -1)
{
width = tag.LSTAttributes[widthIndex].Value;
}
else
{
foreach (LayoutAttribute attr in section.LSTAttributes)
{
if (Utils.CompareStrings(attr.Name, XmlAttributeTypes.WIDTH))
{
width = attr.Value;
}
else if (Utils.CompareStrings(attr.Name, XmlAttributeTypes.COLWIDTH))
{
width = attr.Value;
}
}
}
}
}
return width;
}
示例13: GetBottomBlockMarkupCustom
public static string GetBottomBlockMarkupCustom(XmlTag section)
{
StringBuilder sb = new StringBuilder();
foreach (XmlTag placeholder in section.LSTChildNodes)
{
if (IsCustomBlockDefined(placeholder))
{
sb.Append(ParseCustomBlocks(placeholder));
}
else
{
if (IsSpotLight(placeholder))
{
sb.Append(ParseSpotlight(placeholder));
}
else
{
string id = "sf" + UppercaseFirst(GetAttributeValueByName(placeholder, XmlAttributeTypes.NAME));
sb.Append("<div id='" + id + "' class='sfOuterwrapper sfCurve'>");
sb.Append(GetCommonWrapper(placeholder.InnerHtml));
sb.Append("</div>");
}
}
}
return sb.ToString();
}
示例14: ParseCustomBlocks
static string ParseCustomBlocks(XmlTag placeholder)
{
string activeTemplate = HttpContext.Current.Session["SageFrame.ActiveTemplate"] != null ? HttpContext.Current.Session["SageFrame.ActiveTemplate"].ToString() : "Default";
string FilePath = "E://DotNetProjects//sftemplating//SageFrame//" + activeTemplate + "//sections";
string fileName = GetAttributeValueByName(placeholder, XmlAttributeTypes.NAME);
fileName = UppercaseFirst(fileName);
FilePath = FilePath + fileName + ".htm";
HTMLBuilder hb = new HTMLBuilder();
StringBuilder sb = new StringBuilder();
sb.Append(hb.ReadHTML(FilePath));
return sb.ToString();
}
示例15: GenerateBlockWrappers
public static string GenerateBlockWrappers(XmlTag pch, ref List<int> wrapperdepth)
{
StringBuilder sb = new StringBuilder();
int wrapinner = int.Parse(Utils.GetAttributeValueByName(pch, XmlAttributeTypes.WRAPINNER, "1"));
int wrapouter = int.Parse(Utils.GetAttributeValueByName(pch, XmlAttributeTypes.WRAPOUTER, "1"));
string customclass = Utils.GetAttributeValueByName(pch, XmlAttributeTypes.CLASS);
wrapperdepth.Add(wrapouter);
wrapperdepth.Add(wrapinner);
if (wrapouter != 0)
{
for (int i = 1; i <= wrapouter; i++)
{
if (i == 1)
{
string wrapperclass = wrapouter > 1 ? "sfOuterwrapper" : "sfOuterwrapper clearfix";
wrapperclass = customclass != "" ? string.Format("{0} {1}", wrapperclass, customclass) : wrapperclass;
sb.Append(string.Format("<div id='sf{0}' class='{1}'>", Utils.UppercaseFirst(Utils.GetAttributeValueByName(pch, XmlAttributeTypes.NAME)), wrapperclass));
}
else
{
string wrapperclass = wrapouter == i ? string.Format("sfOuterwrapper{0} clearfix", i - 1) : string.Format("sfOuterwrapper{0}", i - 1);
wrapperclass = customclass != "" ? string.Format("{0} {1}", wrapperclass, customclass) : wrapperclass;
sb.Append(string.Format("<div class='{0}'>", wrapperclass));
}
}
}
else if (wrapouter == 0)
{
sb.Append(string.Format("<div id='sf{0}'>", Utils.UppercaseFirst(Utils.GetAttributeValueByName(pch, XmlAttributeTypes.NAME))));
}
if (wrapinner != 0)
{
for (int i = 1; i <= wrapinner; i++)
{
if (i == 1)
{
string wrapperclass = wrapinner > 1 ? "sfInnerwrapper" : "sfInnerwrapper clearfix";
sb.Append(string.Format("<div class='{0}'>", wrapperclass));
}
else
{
string wrapperclass = wrapinner == i ? string.Format("sfInnerwrapper{0} clearfix", i - 1) : string.Format("sfInnerwrapper{0}", i - 1);
sb.Append(string.Format("<div class='{0}'>", wrapperclass));
}
}
}
return sb.ToString();
}