当前位置: 首页>>代码示例>>C#>>正文


C# Document.ToXml方法代码示例

本文整理汇总了C#中umbraco.cms.businesslogic.web.Document.ToXml方法的典型用法代码示例。如果您正苦于以下问题:C# Document.ToXml方法的具体用法?C# Document.ToXml怎么用?C# Document.ToXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在umbraco.cms.businesslogic.web.Document的用法示例。


在下文中一共展示了Document.ToXml方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getPreviewOrPublishedNode

 private static XmlNode getPreviewOrPublishedNode(Document d, XmlDocument xmlContentCopy, bool isPreview)
 {
     if (isPreview)
     {
         return d.ToPreviewXml(xmlContentCopy);
     }
     else
     {
         return d.ToXml(xmlContentCopy, false);
     }
 }
开发者ID:elrute,项目名称:Triphulcas,代码行数:11,代码来源:content.cs

示例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);

//.........这里部分代码省略.........
开发者ID:saciervo,项目名称:Umbraco-CMS,代码行数:101,代码来源:CreatedPackage.cs

示例3: OnRenderNode

        /// <summary>
        /// Called when [render node].
        /// </summary>
        /// <param name="xNode">The x node.</param>
        /// <param name="doc">The doc.</param>
        protected override void OnRenderNode(ref XmlTreeNode xNode, Document doc)
        {
            base.OnRenderNode(ref xNode, doc);

            var dataTypeId = this.GetDataTypeId();
            var xpath = this.GetXPathFromCookie(dataTypeId);
            var xPathType = this.GetXPathFilterTypeFromCookie(dataTypeId);

            // resolves any Umbraco params in the XPath
            xpath = uQuery.ResolveXPath(xpath);

            var xDoc = new XmlDocument();
            XmlNode xmlDoc;
            if (!doc.Published)
            {
                xmlDoc = doc.ToPreviewXml(xDoc);
            }
            else
            {
                xmlDoc = doc.ToXml(xDoc, false);
            }

            var xmlString = "<root>" + xmlDoc.OuterXml + "</root>";
            var xml = XElement.Parse(xmlString);

            xNode.DetermineClickable(xpath, xPathType, xml);

            //ensure that the NodeKey is passed through
            xNode.Source = this.GetTreeServiceUrlWithParams(int.Parse(xNode.NodeID), dataTypeId);
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:35,代码来源:FilteredContentTree.cs


注:本文中的umbraco.cms.businesslogic.web.Document.ToXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。