/// <summary> /// Render HTML text by specifying list of AttributeSet. /// </summary> /// <param name="attrSets">List of AttributeSet objects.</param> /// <param name="errorList">The <c>IErrorSetCollection</c> object returned by <c>Validate</c> method. /// Set null if you don't have one.</param> /// <returns>The generated HTML text that is encapsulated in HTML table element.</returns> public string RenderHtml(IAttributeSetCollection attrSets, IErrorSetCollection errorList) { StringBuilder sb = new StringBuilder(); // Add identification information for parsing. int ordinal = 0; foreach (AttributeSet attrSet in attrSets) { string goodProdId = (attrSet.ProductID != null && attrSet.ProductID.Length > 0) ? attrSet.ProductID : ""; AddHiddenInputTag(sb, CAT_CS_ID + ordinal.ToString(), attrSet.CategoryID.ToString() + "_" + attrSet.attributeSetID.ToString() + "_" + goodProdId); ordinal++; } XmlDocument xmlDoc = mXmlProvider.GetMultipleCSXml(attrSets); // Add SelectedAttributes node. XmlNode selectedAttributes = xmlDoc.CreateElement(SELECTED_ATTRIBUTES); XmlNode eBayNode = xmlDoc.SelectSingleNode("//eBay"); eBayNode.AppendChild(selectedAttributes); foreach (AttributeSet attrSet in attrSets) { string attrSetName = attrSet.Name; if (attrSetName != null && attrSetName.Equals(RETURN_POLICY)) { XmlAttribute retPolicyAttr = xmlDoc.CreateAttribute(PAGE_ID); retPolicyAttr.Value = RETURN_POLICY_PAGE_ID; selectedAttributes.Attributes.Append(retPolicyAttr); } selectedAttributes.AppendChild(GetSelectedAttributesXml(xmlDoc, attrSet)); } // Add error node. XmlNode errNode = null; if (errorList != null && errorList.Count != 0) { errNode = AddErrorElements(xmlDoc, eBayNode, errorList); } // Generate html text. DOMDocument30 doc = new DOMDocument30(); doc.loadXML(xmlDoc.InnerXml); mXmlToRender = doc; string table = doc.transformNode(this.mXslDoc); sb.Append(table); // Cleanup. if (errNode != null) { eBayNode.RemoveChild(errNode); } eBayNode.RemoveChild(selectedAttributes); return(sb.ToString()); }
/// <summary> /// Render HTML text by specifying list of AttributeSet and xsl Document. /// </summary> /// <param name="attrSets">List of AttributeSet objects.</param> /// <param name="xslDoc">Xsl Document</param> /// <param name="errorList">The <c>IErrorSetCollection</c> object returned by <c>Validate</c> method. /// Set null if you don't have one.</param> /// <returns>The generated HTML text that is encapsulated in HTML table element.</returns> public string RenderHtml(IAttributeSetCollection attrSets, DOMDocument30 xslDoc, IErrorSetCollection errorList) { mXslDoc = xslDoc; return(RenderHtml(attrSets, errorList)); }
/// <summary> /// Render HTML text by specifying list of AttributeSet and xsl Document. /// </summary> /// <param name="attrSets">List of AttributeSet objects.</param> /// <param name="xslDoc">Xsl Document</param> /// <param name="errorList">The <c>IErrorSetCollection</c> object returned by <c>Validate</c> method. /// Set null if you don't have one.</param> /// <returns>The generated HTML text that is encapsulated in HTML table element.</returns> public string RenderHtml(IAttributeSetCollection attrSets, DOMDocument30 xslDoc, IErrorSetCollection errorList) { mXslDoc = xslDoc; return RenderHtml(attrSets, errorList); }
/// <summary> /// Render HTML text by specifying list of AttributeSet. /// </summary> /// <param name="attrSets">List of AttributeSet objects.</param> /// <param name="errorList">The <c>IErrorSetCollection</c> object returned by <c>Validate</c> method. /// Set null if you don't have one.</param> /// <returns>The generated HTML text that is encapsulated in HTML table element.</returns> public string RenderHtml(IAttributeSetCollection attrSets, IErrorSetCollection errorList) { StringBuilder sb = new StringBuilder(); // Add identification information for parsing. int ordinal = 0; foreach(AttributeSet attrSet in attrSets) { string goodProdId = (attrSet.ProductID != null && attrSet.ProductID.Length > 0) ? attrSet.ProductID : ""; AddHiddenInputTag(sb, CAT_CS_ID + ordinal.ToString(), attrSet.CategoryID.ToString() + "_" + attrSet.attributeSetID.ToString() + "_" + goodProdId); ordinal ++; } XmlDocument xmlDoc = mXmlProvider.GetMultipleCSXml(attrSets); // Add SelectedAttributes node. XmlNode selectedAttributes = xmlDoc.CreateElement(SELECTED_ATTRIBUTES); XmlNode eBayNode = xmlDoc.SelectSingleNode("//eBay"); eBayNode.AppendChild(selectedAttributes); foreach(AttributeSet attrSet in attrSets) { string attrSetName = attrSet.Name; if(attrSetName != null && attrSetName.Equals(RETURN_POLICY)) { XmlAttribute retPolicyAttr = xmlDoc.CreateAttribute(PAGE_ID); retPolicyAttr.Value = RETURN_POLICY_PAGE_ID; selectedAttributes.Attributes.Append(retPolicyAttr); } selectedAttributes.AppendChild(GetSelectedAttributesXml(xmlDoc, attrSet)); } // Add error node. XmlNode errNode = null; if( errorList != null && errorList.Count != 0 ) { errNode = AddErrorElements(xmlDoc, eBayNode, errorList); } // Generate html text. DOMDocument30 doc = new DOMDocument30(); doc.loadXML(xmlDoc.InnerXml); mXmlToRender = doc; string table = doc.transformNode(this.mXslDoc); sb.Append(table); // Cleanup. if( errNode != null ) { eBayNode.RemoveChild(errNode); } eBayNode.RemoveChild(selectedAttributes); return sb.ToString(); }