Ejemplo 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);
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
0
 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);
 }
Ejemplo 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;
        }
Ejemplo 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;
        }
Ejemplo 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));
        }
Ejemplo 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();
        }
Ejemplo 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();
        }
Ejemplo n.º 9
0
 public void AddChild(CommandCall child)
 {
     Children.Add(child);
 }
Ejemplo n.º 10
0
 public XmlSpecification(CommandCall rootCommandNode)
 {
     RootCommandNode = rootCommandNode;
 }
Ejemplo n.º 11
0
 public virtual void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
 {
 }
Ejemplo n.º 12
0
 public virtual void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
 {
 }
Ejemplo n.º 13
0
 public void AddChild(CommandCall child)
 {
     Children.Add(child);
 }
Ejemplo n.º 14
0
 public void Setup(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
 {
 }
Ejemplo n.º 15
0
 public void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder)
 {
     this.LogWriter.WriteLine(commandCall.Element.Text);
 }