Sage.Modules.ModuleResult.AppendDataNode C# (CSharp) Метод

AppendDataNode() публичный Метод

Creates a mod:data node in the current module.
If this method is invoked with no arguments, a mod:data element will be created (if it doesn't exist in the current module) and the final mod:data element will be returned. If an element whose name is mod:data is supplied, if will either be appended to the current module (if the module doesn't have a mod:data element already) or it will replace the existing mod:data element if one exists already. The node that will be returned will be the appended copy of the specified dataNode.
public AppendDataNode ( XmlNode dataNode = null ) : XmlNode
dataNode System.Xml.XmlNode Optional data node to add to the current module's element.
Результат System.Xml.XmlNode
        public XmlNode AppendDataNode(XmlNode dataNode = null)
        {
            Contract.Requires<InvalidOperationException>(this.ResultElement != null, "The ModuleResult.ResultElement property is null");

            if (dataNode == null)
                dataNode = this.OwnerDocument.CreateElement("mod:data", XmlNamespaces.ModulesNamespace);

            return this.AppendOrPrependDataNode(dataNode, false);
        }

Usage Example

Пример #1
0
        public ModuleResult ProcessElement(XmlElement moduleElement, ViewConfiguration configuration)
        {
            ModuleResult result = new ModuleResult(moduleElement);
            XmlDocument ownerDoc = moduleElement.OwnerDocument;
            XmlElement dataElement = ownerDoc.CreateElement("mod:data", XmlNamespaces.ModulesNamespace);
            XmlElement metaElement = dataElement.AppendElement("mod:meta", XmlNamespaces.ModulesNamespace);

            SageContext context = configuration.Context;
            foreach (MetaViewInfo info in context.ProjectConfiguration.MetaViews.Values)
            {
                XmlElement viewElement = metaElement.AppendElement("mod:view", XmlNamespaces.ModulesNamespace);
                viewElement.SetAttribute("name", info.Name);
                viewElement.InnerText = info.Description;
            }

            result.AppendDataNode(dataElement);
            return result;
        }
All Usage Examples Of Sage.Modules.ModuleResult::AppendDataNode