Ejemplo n.º 1
0
        public static bool ParseContextElement(Element element, ExpressionTerm expressionPart)
        {
            if (expressionPart.IsValidFunctionByName(".TargetElementName") == true)
            {
                element.TargetElementName = expressionPart.Value;
                return(true);
            }
            else if (expressionPart.IsValidFunctionByName("TargetElementText") == true)
            {
                element.TargetElementText = expressionPart.Value;
                element.TextFunction      = expressionPart.FunctionArgument;
                element.Equal             = expressionPart.ExpressionBooleanCondition;
                return(true);
            }
            else if (expressionPart.IsValidFunctionByRegex("Attribute(.*)\\.Text") == true)
            {
                element.Attributes.Add(new Model.Attribute(expressionPart.FunctionArgument)
                {
                    Text = expressionPart.Value, ExactMatch = true
                });
                return(true);
            }
            else if (expressionPart.IsValidFunctionByRegex("Attribute(.*)\\.Contains") == true)
            {
                element.Attributes.Add(new Model.Attribute(expressionPart.FunctionArgument)
                {
                    Text = expressionPart.Value, Equal = expressionPart.ExpressionBooleanCondition
                });
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        public static bool ParseParent(Element element, ExpressionTerm expressionPart)
        {
            if (expressionPart.IsValidFunctionByName("Parent.Name") == true)
            {
                EnsureParent(element);
                element.Parent.Name = expressionPart.Value;
                return(true);
            }
            else if (expressionPart.IsValidFunctionByName("Parent.Text") == true)
            {
                EnsureParent(element);
                element.Parent.Text              = expressionPart.Value;
                element.Parent.TextFunction      = expressionPart.FunctionArgument;
                element.Parent.TextContainsEqual = expressionPart.ExpressionBooleanCondition;
                return(true);
            }
            else if (expressionPart.IsValidFunctionByRegex("Parent.Attribute(.*)\\.Contains") == true)
            {
                EnsureParent(element);
                element.Parent.Attributes.Add(new Model.Attribute(expressionPart.FunctionArgument)
                {
                    Text = expressionPart.Value, Equal = expressionPart.ExpressionBooleanCondition
                });
                return(true);
            }
            else if (expressionPart.IsValidFunctionByRegex("Parent.Attribute(.*)\\.Text") == true)
            {
                EnsureParent(element);
                element.Parent.Attributes.Add(new Model.Attribute(expressionPart.FunctionArgument)
                {
                    Text = expressionPart.Value, ExactMatch = true
                });
                return(true);
            }
            else if (expressionPart.IsValidFunctionByName("Parent.Position") == true)
            {
                element.Parent.Position = Int32.Parse(expressionPart.Value);
                return(true);
            }

            return(false);
        }