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); }
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; }
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; }
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)); }
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 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); }
public XmlSpecification(CommandCall rootCommandNode) { RootCommandNode = rootCommandNode; }
public virtual void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { }
public virtual void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { }
public void AddChild(CommandCall child) { Children.Add(child); }
public void Setup(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { }
public void Execute(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { this.LogWriter.WriteLine(commandCall.Element.Text); }