コード例 #1
0
        /// <summary>
        ///     Adds an event property for which the runtime uses the supplied XPath expression against
        ///     a DOM document node to resolve a property value.
        /// </summary>
        /// <param name="name">of the event property</param>
        /// <param name="xpath">is an arbitrary xpath expression</param>
        /// <param name="type">a constant obtained from System.Xml.XPath.XPathResultType.</param>
        /// <param name="castToType">is the type name of the type that the return value of the xpath expression is casted to</param>
        public void AddXPathProperty(
            string name,
            string xpath,
            XPathResultType type,
            string castToType)
        {
            Type castToTypeClass = null;

            if (castToType != null) {
                var isArray = false;
                if (castToType.Trim().EndsWith("[]")) {
                    isArray = true;
                    castToType = castToType.Replace("[]", "");
                }

                castToTypeClass = TypeHelper.GetTypeForSimpleName(castToType, ClassForNameProviderDefault.INSTANCE);
                if (castToTypeClass == null) {
                    throw new ConfigurationException(
                        "Invalid cast-to type for xpath expression named '" + name + "', the type is not recognized");
                }

                if (isArray) {
                    castToTypeClass = castToTypeClass.MakeArrayType();
                }
            }

            var desc = new XPathPropertyDesc(name, xpath, type, castToTypeClass);
            XPathProperties.Put(name, desc);
        }
コード例 #2
0
 /// <summary>
 ///     Adds an event property for which the runtime uses the supplied XPath expression against
 ///     a DOM document node to resolve a property value.
 /// </summary>
 /// <param name="name">of the event property</param>
 /// <param name="xpath">is an arbitrary xpath expression</param>
 /// <param name="type">a constant obtained from System.Xml.XPath.XPathResultType.</param>
 public void AddXPathProperty(
     string name,
     string xpath,
     XPathResultType type)
 {
     var desc = new XPathPropertyDesc(name, xpath, type);
     XPathProperties.Put(name, desc);
 }
コード例 #3
0
        /// <summary>
        ///     Adds an event property for which the runtime uses the supplied XPath expression against
        ///     a DOM document node to resolve a property value.
        /// </summary>
        /// <param name="name">of the event property</param>
        /// <param name="xpath">is an arbitrary xpath expression</param>
        /// <param name="type">a constant obtained from System.Xml.XPath.XPathResultType.</param>
        /// <param name="eventTypeName">is the name of another event type that represents the XPath nodes</param>
        public void AddXPathPropertyFragment(
            string name,
            string xpath,
            XPathResultType type,
            string eventTypeName)
        {
            if ((type != XPathResultType.Any) && (type != XPathResultType.NodeSet)) {
                throw new ArgumentException(
                    "XPath property for fragments requires an XmlNode or XmlNodeset return value for property '" +
                    name +
                    "'");
            }

            var desc = new XPathPropertyDesc(name, xpath, type, eventTypeName);
            XPathProperties.Put(name, desc);
        }