Esempio n. 1
0
        private void GenerateCommandCallTree(XElement element, CommandCall parentCommandCall, Resource resource)
        {
            bool isCommandAssigned = false;

            foreach (XAttribute attribute in element.Attributes())
            {
                string namespaceURI = attribute.Name.Namespace.NamespaceName;

                if (!attribute.IsNamespaceDeclaration && !String.IsNullOrEmpty(namespaceURI))
                {
                    string   commandName = attribute.Name.LocalName;
                    ICommand command     = CreateCommand(namespaceURI, commandName);
                    if (command != null)
                    {
                        Check.IsFalse(isCommandAssigned, "Multiple commands per element is currently not supported.");
                        isCommandAssigned = true;
                        String      expression  = attribute.Value;
                        CommandCall commandCall = new CommandCall(command, new Element(element), expression, resource);
                        parentCommandCall.AddChild(commandCall);
                        parentCommandCall = commandCall;
                    }
                }
            }

            foreach (XElement child in element.Elements())
            {
                GenerateCommandCallTree(child, parentCommandCall, resource);
            }
        }
        private void GenerateCommandCallTree(XElement element, CommandCall parentCommandCall, Resource resource)
        {
            bool isCommandAssigned = false;

            foreach (XAttribute attribute in element.Attributes())
            {
                string namespaceURI = attribute.Name.Namespace.NamespaceName;

                if (!attribute.IsNamespaceDeclaration && !String.IsNullOrEmpty(namespaceURI))
                {
                    string commandName = attribute.Name.LocalName;
                    ICommand command = CreateCommand(namespaceURI, commandName);
                    if (command != null)
                    {
                        Check.IsFalse(isCommandAssigned, "Multiple commands per element is currently not supported.");
                        isCommandAssigned = true;
                        String expression = attribute.Value;
                        CommandCall commandCall = new CommandCall(command, new Element(element), expression, resource);
                        parentCommandCall.AddChild(commandCall);
                        parentCommandCall = commandCall;
                    }
                }
            }

            foreach (XElement child in element.Elements())
            {
                GenerateCommandCallTree(child, parentCommandCall, resource);
            }
        }
 public ISpecification Parse(XDocument document, Resource resource)
 {
     OnDocumentParsing(document);
     XElement rootElement = document.Root;
     CommandCall rootCommandCall = new CommandCall(CreateSpecificationCommand(), new Element(rootElement), "", resource);
     GenerateCommandCallTree(rootElement, rootCommandCall, resource);
     return new XmlSpecification(rootCommandCall);
 }
Esempio n. 4
0
        public ListSupport(CommandCall listCommandCall)
        {
            if (!(listCommandCall.Element.IsNamed("ol") || listCommandCall.Element.IsNamed("ul")))
            {
                throw new ArgumentException("This strategy can only work on list elements", "listCommandCall");
            }

            ListCommandCall = listCommandCall;
        }
Esempio n. 5
0
        public ListSupport(CommandCall listCommandCall)
        {
            if (!(listCommandCall.Element.IsNamed("ol") || listCommandCall.Element.IsNamed("ul")))
            {
                throw new ArgumentException("This strategy can only work on list elements", "listCommandCall");
            }

            ListCommandCall = listCommandCall;
        }
Esempio n. 6
0
        public ISpecification Parse(XDocument document, Resource resource)
        {
            AnnounceBeforeParsing(document);
            XElement    rootElement     = document.Root;
            CommandCall rootCommandCall = new CommandCall(CreateSpecificationCommand(), new Element(rootElement), "", resource);

            GenerateCommandCallTree(rootElement, rootCommandCall, resource);
            return(new XmlSpecification(rootCommandCall));
        }
Esempio n. 7
0
        public TableSupport(CommandCall tableCommandCall)
        {
            if (!tableCommandCall.Element.IsNamed("table"))
            {
                throw new ArgumentException("This strategy can only work on table elements", "tableCommandCall");
            }

            TableCommandCall = tableCommandCall;
            Table            = new Table(tableCommandCall.Element);

            CommandCallByColumn = new Dictionary <int, CommandCall>();
            PopulateCommandCallByColumnMap();
        }
Esempio n. 8
0
        public TableSupport(CommandCall tableCommandCall)
        {
            if (!tableCommandCall.Element.IsNamed("table"))
            {
                throw new ArgumentException("This strategy can only work on table elements", "tableCommandCall");
            }

            TableCommandCall = tableCommandCall;
            Table = new Table(tableCommandCall.Element);

            CommandCallByColumn = new Dictionary<int, CommandCall>();
            PopulateCommandCallByColumnMap();
        }
 public void AddChild(CommandCall child)
 {
     Children.Add(child);
 }
Esempio n. 10
0
 public XmlSpecification(CommandCall rootCommandNode)
 {
     RootCommandNode = rootCommandNode;
 }
Esempio n. 11
0
 public virtual void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
 {
 }
Esempio n. 12
0
 public virtual void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
 {
 }
Esempio n. 13
0
 public void AddChild(CommandCall child)
 {
     Children.Add(child);
 }
Esempio n. 14
0
 public void Setup(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
 {
 }
Esempio n. 15
0
 public void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
 {
     this.LogWriter.WriteLine(commandCall.Element.Text);
 }