]> saetta.ns0.it Git - zakform/libzakform/commitdiff
Added property regex to ZakFormElementValidatorRegex.
authorAndrea Zagli <azagli@libero.it>
Sat, 6 Jan 2018 10:58:27 +0000 (11:58 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 6 Jan 2018 10:58:27 +0000 (11:58 +0100)
src/formelementvalidatorregex.c

index 8614ebf63bf3c344187616a3eb9ac1c1d6b48df7..ddce8a55bc4cae2b8f53b0547a96142d93f3326e 100644 (file)
@@ -122,7 +122,14 @@ ZakFormElementValidatorRegex
 static gboolean
 zak_form_element_validator_regex_xml_parsing (ZakFormElementValidator *validator, xmlNode *xnode)
 {
-       zak_form_element_validator_regex_set_regex (ZAK_FORM_ELEMENT_VALIDATOR_REGEX (validator), (gchar *)xmlNodeGetContent (xnode));
+       if (xmlGetProp (xnode, (xmlChar *)"regex") != NULL)
+               {
+                       zak_form_element_validator_regex_set_regex (ZAK_FORM_ELEMENT_VALIDATOR_REGEX (validator), (gchar *)xmlGetProp (xnode, (xmlChar *)"regex"));
+               }
+       else
+               {
+                       zak_form_element_validator_regex_set_regex (ZAK_FORM_ELEMENT_VALIDATOR_REGEX (validator), (gchar *)xmlNodeGetContent (xnode));
+               }
 
        return TRUE;
 }