예제 #1
0
        /// <summary>
        /// Add a regex depending on three nodes
        /// </summary>
        /// <param name="languageNode">The language node</param>
        /// <param name="subNode">The first sub-node</param>
        /// <param name="subNode2">The second sub-node</param>
        /// <param name="sRegExp">The regular expression string</param>
        /// <exception cref="ArgumentNullException">This is thrown if a node
        /// parameter is null or the regular expression is null.</exception>
        /// <exception cref="ArgumentException">This is thrown if a node
        /// parameter does not have an 'id' attribute or if the regular
        /// expression could not be created.</exception>
        internal void AddKey(XmlNode languageNode, XmlNode subNode,
                             XmlNode subNode2, string sRegExp)
        {
            Regex regExp = new Regex(sRegExp,
                                     RegexDictionary.GetRegexOptions(languageNode));

            if (regExp == null)
            {
                throw new ArgumentException(
                          "Could not create regular expression");
            }

            dictionary.Add(RegexDictionary.KeyName(languageNode, subNode,
                                                   subNode2), regExp);
        }
예제 #2
0
 /// <summary>
 /// Retrieves the regular expression out of 3 nodes
 /// </summary>
 /// <param name="languageNode">The language node</param>
 /// <param name="subNode">The first sub-node</param>
 /// <param name="subNode2">The second sub-node</param>
 /// <returns>The regular expression</returns>
 /// <exception cref="ArgumentNullException">This is thrown if a node
 /// parameter is null or the regular expression is null.</exception>
 /// <exception cref="ArgumentException">This is thrown if a node
 /// parameter does not have an 'id' attribute.</exception>
 internal Regex GetKey(XmlNode languageNode, XmlNode subNode,
                       XmlNode subNode2)
 {
     return(dictionary[RegexDictionary.KeyName(languageNode, subNode,
                                               subNode2)]);
 }