Ejemplo n.º 1
0
        /// <summary>
        /// Process the current XmlNode - act based on each type
        /// </summary>
        /// <param name="node"></param>
        /// <param name="output"></param>
        void ProcessNode(XmlNode node, StringBuilder output, EntityMetadata entityMeta = null)
        {
            LogMessage("Process node: " + node.Name, EnumLoggingLevel.Information);

            // loop on the child nodes and process each child element
            switch (node.NodeType)
            {
            case XmlNodeType.CDATA:
                output.AppendLine(ProcessCDataSection(node.InnerText));
                break;

            case XmlNodeType.Element:
                switch (node.Name)
                {
                case "template":
                    ProcessChildNodes(node, output);
                    break;

                // Entity Element - iterate on each of the incoming entity metadata items
                case "entity":
                    ProcessEntitiesList(node, output);
                    break;

                // Attribute list... should only be a single CData element, no other children
                // grab this template and iterate on entity attributes
                case "attribute_list":
                    var cdata = node.FirstChild.InnerText;
                    foreach (var attrib in entityMeta.Attributes)
                    {
                        // filter based on configuration settings
                        if (_configuration.FilterAttribute(attrib.SchemaName))
                        {
                            continue;
                        }

                        // decide whether we want to include processing a virtual attrib
                        if (attrib.AttributeType == AttributeTypeCode.Virtual && !_configuration.IncludeVirtualAttribute)
                        {
                            continue;
                        }

                        output.AppendLine(ProcessCDataSection(cdata, attrib));
                    }
                    break;
                }
                break;
            }
        }