protected void ProcessAppender(XmlElement xe, string parentName, Dictionary<string, string> appenderNames, Sequence sequence,
            IEnumerable<AttributeInfo> appenderAttributes, string jsCreateMethodName, List<XmlHelpers.TagInfo> childTagInfos, StringBuilder sb)
        {
            if (xe == null) { return; }

            string appenderName = XmlHelpers.RequiredAttribute(xe, "name");

            string appenderVariableName = string.Format("{0}{1}", Constants.JsAppenderVariablePrefix, sequence.Next());
            appenderNames[appenderName] = appenderVariableName;

            JavaScriptHelpers.GenerateCreate(appenderVariableName, jsCreateMethodName, appenderName, sb);
            Utils.ProcessOptionAttributes(
                appenderVariableName, xe, appenderAttributes, null, sb, (attributeValues) => { Validate(appenderName, attributeValues); });

            XmlHelpers.ProcessNodeList(
                xe.ChildNodes,
                childTagInfos,
                appenderVariableName, appenderNames, sequence, sb);
        }
示例#2
0
        // For the interface descriptions of these methods, see XmlHelpers.XmlElementProcessor delegate.
        // ---- Appender and its children
        private void ProcessAppender(XmlElement xe, string parentName, Dictionary<string, string> appenderNames, Sequence sequence, StringBuilder sb)
        {
            if (xe == null) { return; }

            string appenderName = XmlHelpers.RequiredAttribute(xe, "name");
            string appenderUrl = XmlHelpers.OptionalAttribute(
                xe, "url", AppenderDefaultUrl, @"^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\-._~:/?#[\]@!$&'()*+,;=]+$");

            string appenderVariableName = string.Format("{0}{1}", JsAppenderVariablePrefix, sequence.Next());
            appenderNames[appenderName] = appenderVariableName;

            JavaScriptHelpers.GenerateAppender(appenderVariableName, appenderUrl, sb);

            XmlHelpers.ProcessNodeList(
                xe.ChildNodes,
                new[] {
                    new XmlHelpers.TagInfo("level", ProcessAppenderLevel, new Regex("^value$"), 1),
                    new XmlHelpers.TagInfo("userAgentRegex", ProcessAppenderUserAgentRegex, new Regex("^value$"), 1),
                    new XmlHelpers.TagInfo("ipRegex", ProcessAppenderIpRegex, new Regex("^value$"), 1),
                    new XmlHelpers.TagInfo("batchSize", ProcessBatchSize, new Regex("^value$"), 1),
                    new XmlHelpers.TagInfo("timerInterval", ProcessTimerInterval, new Regex("^value$"), 1),
                    new XmlHelpers.TagInfo("sessionId", ProcessSessionId, new Regex("^value$"), 1)
                },
                appenderVariableName, appenderNames, sequence, sb);
        }