mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-28 00:21:53 +03:00
Finally commiting work done on the plane, major cleanup,
spread some serious anti bitrot all over the place: - parserInternals.c parserInternals.h parser.c Makefile.am: created a new module parserInternals.c, moved most of the code shared by the various parsers there, as well as deprecated code from parser.c. More cleanup of parser.c - uri.c: fixed a problem when URI is NULL - valid.c: speedup when looking for an attribute declaration Daniel
This commit is contained in:
29
valid.c
29
valid.c
@ -2294,14 +2294,41 @@ xmlGetDtdQElementDesc(xmlDtdPtr dtd, const xmlChar *name,
|
||||
xmlAttributePtr
|
||||
xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name) {
|
||||
xmlAttributeTablePtr table;
|
||||
xmlElementTablePtr etable;
|
||||
xmlAttributePtr cur;
|
||||
xmlElementPtr ecur;
|
||||
xmlChar *uqname = NULL, *prefix = NULL;
|
||||
int i;
|
||||
|
||||
if (dtd == NULL) return(NULL);
|
||||
if (dtd->attributes == NULL) return(NULL);
|
||||
table = (xmlAttributeTablePtr) dtd->attributes;
|
||||
|
||||
/*
|
||||
* Faster lookup through the element table
|
||||
*/
|
||||
etable = (xmlElementTablePtr) dtd->elements;
|
||||
if (etable != NULL) {
|
||||
for (i = 0;i < etable->nb_elements;i++) {
|
||||
ecur = etable->table[i];
|
||||
if (!xmlStrcmp(ecur->name, elem)) {
|
||||
cur = ecur->attributes;
|
||||
while (cur != NULL) {
|
||||
if (!xmlStrcmp(cur->name, name))
|
||||
return(cur);
|
||||
cur = cur->nexth;
|
||||
}
|
||||
/* TODO: same accelerator for QNames !!! */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Miss on the element table, retry on the attribute one
|
||||
*/
|
||||
|
||||
table = (xmlAttributeTablePtr) dtd->attributes;
|
||||
if (table == NULL)
|
||||
return(NULL);
|
||||
for (i = 0;i < table->nb_attributes;i++) {
|
||||
cur = table->table[i];
|
||||
if ((!xmlStrcmp(cur->name, name)) &&
|
||||
|
Reference in New Issue
Block a user