mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-08-01 10:06:59 +03:00
added a new API to split a QName without generating any memory allocation
* tree.c include/libxml/tree.h: added a new API to split a QName without generating any memory allocation * valid.c: fixed another problem with namespaces on element in mixed content case * python/tests/reader2.py: updated the testcase with Bjorn Reese fix to reader for unsignificant white space * parser.c HTMLparser.c: cleanup. Daniel
This commit is contained in:
65
valid.c
65
valid.c
@ -5059,24 +5059,55 @@ done:
|
||||
static int
|
||||
xmlValidateCheckMixed(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
|
||||
xmlElementContentPtr cont, const xmlChar *qname) {
|
||||
while (cont != NULL) {
|
||||
if (cont->type == XML_ELEMENT_CONTENT_ELEMENT) {
|
||||
if (xmlStrEqual(cont->name, qname))
|
||||
return(1);
|
||||
} else if ((cont->type == XML_ELEMENT_CONTENT_OR) &&
|
||||
(cont->c1 != NULL) &&
|
||||
(cont->c1->type == XML_ELEMENT_CONTENT_ELEMENT)){
|
||||
if (xmlStrEqual(cont->c1->name, qname))
|
||||
return(1);
|
||||
} else if ((cont->type != XML_ELEMENT_CONTENT_OR) ||
|
||||
(cont->c1 == NULL) ||
|
||||
(cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){
|
||||
/* Internal error !!! */
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Internal: MIXED struct bad\n");
|
||||
break;
|
||||
const xmlChar *name;
|
||||
int plen;
|
||||
name = xmlSplitQName3(qname, &plen);
|
||||
|
||||
if (name == NULL) {
|
||||
while (cont != NULL) {
|
||||
if (cont->type == XML_ELEMENT_CONTENT_ELEMENT) {
|
||||
if ((cont->prefix == NULL) && (xmlStrEqual(cont->name, qname)))
|
||||
return(1);
|
||||
} else if ((cont->type == XML_ELEMENT_CONTENT_OR) &&
|
||||
(cont->c1 != NULL) &&
|
||||
(cont->c1->type == XML_ELEMENT_CONTENT_ELEMENT)){
|
||||
if ((cont->c1->prefix == NULL) &&
|
||||
(xmlStrEqual(cont->c1->name, qname)))
|
||||
return(1);
|
||||
} else if ((cont->type != XML_ELEMENT_CONTENT_OR) ||
|
||||
(cont->c1 == NULL) ||
|
||||
(cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){
|
||||
/* Internal error !!! */
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Internal: MIXED struct bad\n");
|
||||
break;
|
||||
}
|
||||
cont = cont->c2;
|
||||
}
|
||||
} else {
|
||||
while (cont != NULL) {
|
||||
if (cont->type == XML_ELEMENT_CONTENT_ELEMENT) {
|
||||
if ((cont->prefix != NULL) &&
|
||||
(xmlStrncmp(cont->prefix, qname, plen) == 0) &&
|
||||
(xmlStrEqual(cont->name, name)))
|
||||
return(1);
|
||||
} else if ((cont->type == XML_ELEMENT_CONTENT_OR) &&
|
||||
(cont->c1 != NULL) &&
|
||||
(cont->c1->type == XML_ELEMENT_CONTENT_ELEMENT)){
|
||||
if ((cont->c1->prefix != NULL) &&
|
||||
(xmlStrncmp(cont->c1->prefix, qname, plen) == 0) &&
|
||||
(xmlStrEqual(cont->c1->name, name)))
|
||||
return(1);
|
||||
} else if ((cont->type != XML_ELEMENT_CONTENT_OR) ||
|
||||
(cont->c1 == NULL) ||
|
||||
(cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){
|
||||
/* Internal error !!! */
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Internal: MIXED struct bad\n");
|
||||
break;
|
||||
}
|
||||
cont = cont->c2;
|
||||
}
|
||||
cont = cont->c2;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user