Ejemplo n.º 1
0
        /// <summary>
        /// Adds an event property for which the engine uses the supplied XPath expression againsta DOM document node to resolve a property value.
        /// </summary>
        /// <param name="name">the event property</param>
        /// <param name="xpath">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)
            {
                bool isArray = false;
                if (castToType.Trim().EndsWith("[]"))
                {
                    isArray    = true;
                    castToType = castToType.Replace("[]", "");
                }

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

                if (isArray)
                {
                    castToTypeClass = Array.CreateInstance(castToTypeClass, 0).GetType();
                }
            }

            XPathPropertyDesc desc = new XPathPropertyDesc(name, xpath, type, castToTypeClass);

            XPathProperties.Put(name, desc);
        }
Ejemplo n.º 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>
        /// <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);
        }
Ejemplo n.º 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>
 public void AddXPathProperty(
     string name,
     string xpath,
     XPathResultType type)
 {
     var desc = new XPathPropertyDesc(name, xpath, type);
     XPathProperties.Put(name, desc);
 }
Ejemplo n.º 4
0
        /// <summary>Adds an event property for which the engine 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">is a constant obtained from XPathResultType. Typical values are XPathResultType.NodeSet. </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 Node or Nodeset return value for property '" + name + "'");
            }

            XPathPropertyDesc desc = new XPathPropertyDesc(name, xpath, type, eventTypeName);

            XPathProperties.Put(name, desc);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Adds an event property for which the engine uses the supplied XPath expression against
        /// a DOM document node to resolve a property value.
        /// </summary>
        /// <param name="name">name of the event property</param>
        /// <param name="xpath">is an arbitrary xpath expression</param>
        /// <param name="type">is the return type of the expression</param>

        public void AddXPathProperty(String name, String xpath, XPathResultType type)
        {
            XPathPropertyDesc desc = new XPathPropertyDesc(name, xpath, type);

            XPathProperties[name] = desc;
        }