本文整理汇总了C#中umbraco.cms.businesslogic.template.Template.ToXml方法的典型用法代码示例。如果您正苦于以下问题:C# Template.ToXml方法的具体用法?C# Template.ToXml怎么用?C# Template.ToXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类umbraco.cms.businesslogic.template.Template
的用法示例。
在下文中一共展示了Template.ToXml方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveToDisk
public static void SaveToDisk(Template item)
{
if (item != null)
{
try
{
XmlDocument xmlDoc = helpers.XmlDoc.CreateDoc();
xmlDoc.AppendChild(item.ToXml(xmlDoc));
helpers.XmlDoc.SaveXmlDoc(
item.GetType().ToString(), GetDocPath(item) , "def", xmlDoc);
}
catch (Exception ex)
{
helpers.uSyncLog.ErrorLog(ex, "uSync: Error Saving Template {0} - {1}", item.Text, ex.ToString());
}
}
}
示例2: Publish
public void Publish() {
CreatedPackage package = this;
PackageInstance pack = package.Data;
try
{
PublishEventArgs e = new PublishEventArgs();
package.FireBeforePublish(e);
if (!e.Cancel)
{
int outInt = 0;
//Path checking...
string localPath = IOHelper.MapPath(SystemDirectories.Media + "/" + pack.Folder);
if (!System.IO.Directory.Exists(localPath))
System.IO.Directory.CreateDirectory(localPath);
//Init package file...
createPackageManifest();
//Info section..
appendElement(utill.PackageInfo(pack, _packageManifest));
//Documents...
int _contentNodeID = 0;
if (!String.IsNullOrEmpty(pack.ContentNodeId) && int.TryParse(pack.ContentNodeId, out _contentNodeID))
{
XmlNode documents = _packageManifest.CreateElement("Documents");
XmlNode documentSet = _packageManifest.CreateElement("DocumentSet");
XmlAttribute importMode = _packageManifest.CreateAttribute("importMode", "");
importMode.Value = "root";
documentSet.Attributes.Append(importMode);
documents.AppendChild(documentSet);
//load content from umbraco.
cms.businesslogic.web.Document umbDocument = new Document(_contentNodeID);
documentSet.AppendChild(umbDocument.ToXml(_packageManifest, pack.ContentLoadChildNodes));
appendElement(documents);
}
//Document types..
List<DocumentType> dtl = new List<DocumentType>();
XmlNode docTypes = _packageManifest.CreateElement("DocumentTypes");
foreach (string dtId in pack.Documenttypes)
{
if (int.TryParse(dtId, out outInt))
{
DocumentType docT = new DocumentType(outInt);
AddDocumentType(docT, ref dtl);
}
}
foreach (DocumentType d in dtl)
{
docTypes.AppendChild(d.ToXml(_packageManifest));
}
appendElement(docTypes);
//Templates
XmlNode templates = _packageManifest.CreateElement("Templates");
foreach (string templateId in pack.Templates)
{
if (int.TryParse(templateId, out outInt))
{
Template t = new Template(outInt);
templates.AppendChild(t.ToXml(_packageManifest));
}
}
appendElement(templates);
//Stylesheets
XmlNode stylesheets = _packageManifest.CreateElement("Stylesheets");
foreach (string ssId in pack.Stylesheets)
{
if (int.TryParse(ssId, out outInt))
{
StyleSheet s = new StyleSheet(outInt);
stylesheets.AppendChild(s.ToXml(_packageManifest));
}
}
appendElement(stylesheets);
//Macros
XmlNode macros = _packageManifest.CreateElement("Macros");
foreach (string macroId in pack.Macros)
{
if (int.TryParse(macroId, out outInt))
{
macros.AppendChild(utill.Macro(int.Parse(macroId), true, localPath, _packageManifest));
}
}
appendElement(macros);
//.........这里部分代码省略.........