Exemple #1
0
        private Node ProcessNode(ParsedNode node, DocumentProcessorState state)
        {
            if (IsIgnoredNode(node))
            {
                return(null);
            }

            NodeProcessor nodeProcessor = FindProcessorForNode(node);

            if (null == nodeProcessor)
            {
                state.AddWarning("Processor not found (sectionType={0}, {1})", node.SectionType, node.AttributeBag.ToString());

                return(null);
            }

            if (!Validate(node, nodeProcessor, state))
            {
                return(null);
            }

            List <Node> children = new List <Node>();

            foreach (ParsedNode childNode in node.Children.Nodes)
            {
                Node child = ProcessNode(childNode, state);

                if (null != child)
                {
                    children.Add(child);
                }
            }

            return(nodeProcessor.Convert(node, children.ToArray()));
        }
Exemple #2
0
        private bool Validate(ParsedNode node, NodeProcessor nodeProcessor, DocumentProcessorState state)
        {
            bool validateAttributesResult = ValidateProperties(node, node.AttributeBag, nodeProcessor.AttributeDefinitions, nodeProcessor.IgnoredAttributeNames, state);
            bool validatePropertiesResult = ValidateProperties(node, node.PropertyBag, nodeProcessor.PropertyDefinitions, nodeProcessor.IgnoredPropertyNames, state);

            return(validateAttributesResult && validatePropertiesResult);
        }
Exemple #3
0
 public void AddNodeProcessor(NodeProcessor nodeProcessor)
 {
     _nodeProcessors.Add(nodeProcessor);
 }