| 2889 | */ |
| 2890 | |
| 2891 | static int areBlanks(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, |
| 2892 | int blank_chars) { |
| 2893 | int i; |
| 2894 | xmlNodePtr lastChild; |
| 2895 | |
| 2896 | /* |
| 2897 | * Don't spend time trying to differentiate them, the same callback is |
| 2898 | * used ! |
| 2899 | */ |
| 2900 | if (ctxt->sax->ignorableWhitespace == ctxt->sax->characters) |
| 2901 | return(0); |
| 2902 | |
| 2903 | /* |
| 2904 | * Check for xml:space value. |
| 2905 | */ |
| 2906 | if ((ctxt->space == NULL) || (*(ctxt->space) == 1) || |
| 2907 | (*(ctxt->space) == -2)) |
| 2908 | return(0); |
| 2909 | |
| 2910 | /* |
| 2911 | * Check that the string is made of blanks |
| 2912 | */ |
| 2913 | if (blank_chars == 0) { |
| 2914 | for (i = 0;i < len;i++) |
| 2915 | if (!(IS_BLANK_CH(str[i]))) return(0); |
| 2916 | } |
| 2917 | |
| 2918 | /* |
| 2919 | * Look if the element is mixed content in the DTD if available |
| 2920 | */ |
| 2921 | if (ctxt->node == NULL) return(0); |
| 2922 | if (ctxt->myDoc != NULL) { |
| 2923 | xmlElementPtr elemDecl = NULL; |
| 2924 | xmlDocPtr doc = ctxt->myDoc; |
| 2925 | const xmlChar *prefix = NULL; |
| 2926 | |
| 2927 | if (ctxt->node->ns) |
| 2928 | prefix = ctxt->node->ns->prefix; |
| 2929 | if (doc->intSubset != NULL) |
| 2930 | elemDecl = xmlHashLookup2(doc->intSubset->elements, ctxt->node->name, |
| 2931 | prefix); |
| 2932 | if ((elemDecl == NULL) && (doc->extSubset != NULL)) |
| 2933 | elemDecl = xmlHashLookup2(doc->extSubset->elements, ctxt->node->name, |
| 2934 | prefix); |
| 2935 | if (elemDecl != NULL) { |
| 2936 | if (elemDecl->etype == XML_ELEMENT_TYPE_ELEMENT) |
| 2937 | return(1); |
| 2938 | if ((elemDecl->etype == XML_ELEMENT_TYPE_ANY) || |
| 2939 | (elemDecl->etype == XML_ELEMENT_TYPE_MIXED)) |
| 2940 | return(0); |
| 2941 | } |
| 2942 | } |
| 2943 | |
| 2944 | /* |
| 2945 | * Otherwise, heuristic :-\ |
| 2946 | */ |
| 2947 | if ((RAW != '<') && (RAW != 0xD)) return(0); |
| 2948 | if ((ctxt->node->children == NULL) && |
no test coverage detected