1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-28 00:21:53 +03:00

- configure.in: releasing 2.2.4

- parser.[ch]: added xmlStrEqual()
- HTMLparser.c HTMLtree.c SAX.c debugXML.c entities.c parser.c
  tree.c valid.c xlink.c xpath.c: converted all !xmlStrcmp to
  use xmlStrEqual instead
- TODO: updated
- added an XPath test
Daniel
This commit is contained in:
Daniel Veillard
2000-10-01 20:28:44 +00:00
parent bc765307ff
commit 8b5dd83f46
18 changed files with 256 additions and 203 deletions

View File

@ -1,3 +1,13 @@
Sun Oct 1 22:16:33 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* configure.in: releasing 2.2.4
* parser.[ch]: added xmlStrEqual()
* HTMLparser.c HTMLtree.c SAX.c debugXML.c entities.c parser.c
tree.c valid.c xlink.c xpath.c: converted all !xmlStrcmp to
use xmlStrEqual instead
* TODO: updated
* added an XPath test
Sun Oct 1 20:19:39 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org> Sun Oct 1 20:19:39 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* HTMLparser.c: fixed htmlStartCloseIndexinitialized init * HTMLparser.c: fixed htmlStartCloseIndexinitialized init

View File

@ -612,7 +612,7 @@ htmlTagLookup(const xmlChar *tag) {
for (i = 0; i < (sizeof(html40ElementTable) / for (i = 0; i < (sizeof(html40ElementTable) /
sizeof(html40ElementTable[0]));i++) { sizeof(html40ElementTable[0]));i++) {
if (!xmlStrcmp(tag, BAD_CAST html40ElementTable[i].name)) if (xmlStrEqual(tag, BAD_CAST html40ElementTable[i].name))
return(&html40ElementTable[i]); return(&html40ElementTable[i]);
} }
return(NULL); return(NULL);
@ -639,13 +639,13 @@ htmlCheckAutoClose(const xmlChar *newtag, const xmlChar *oldtag) {
for (index = 0; index < 100;index++) { for (index = 0; index < 100;index++) {
close = htmlStartCloseIndex[index]; close = htmlStartCloseIndex[index];
if (close == NULL) return(0); if (close == NULL) return(0);
if (!xmlStrcmp(BAD_CAST *close, newtag)) break; if (xmlStrEqual(BAD_CAST *close, newtag)) break;
} }
i = close - htmlStartClose; i = close - htmlStartClose;
i++; i++;
while (htmlStartClose[i] != NULL) { while (htmlStartClose[i] != NULL) {
if (!xmlStrcmp(BAD_CAST htmlStartClose[i], oldtag)) { if (xmlStrEqual(BAD_CAST htmlStartClose[i], oldtag)) {
return(1); return(1);
} }
i++; i++;
@ -673,11 +673,11 @@ htmlAutoCloseOnClose(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
#endif #endif
for (i = (ctxt->nameNr - 1);i >= 0;i--) { for (i = (ctxt->nameNr - 1);i >= 0;i--) {
if (!xmlStrcmp(newtag, ctxt->nameTab[i])) break; if (xmlStrEqual(newtag, ctxt->nameTab[i])) break;
} }
if (i < 0) return; if (i < 0) return;
while (xmlStrcmp(newtag, ctxt->name)) { while (!xmlStrEqual(newtag, ctxt->name)) {
info = htmlTagLookup(ctxt->name); info = htmlTagLookup(ctxt->name);
if ((info == NULL) || (info->endTag == 1)) { if ((info == NULL) || (info->endTag == 1)) {
#ifdef DEBUG #ifdef DEBUG
@ -738,9 +738,9 @@ htmlAutoClose(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
htmlAutoCloseOnClose(ctxt, BAD_CAST"html"); htmlAutoCloseOnClose(ctxt, BAD_CAST"html");
} }
while ((newtag == NULL) && (ctxt->name != NULL) && while ((newtag == NULL) && (ctxt->name != NULL) &&
((!xmlStrcmp(ctxt->name, BAD_CAST"head")) || ((xmlStrEqual(ctxt->name, BAD_CAST"head")) ||
(!xmlStrcmp(ctxt->name, BAD_CAST"body")) || (xmlStrEqual(ctxt->name, BAD_CAST"body")) ||
(!xmlStrcmp(ctxt->name, BAD_CAST"html")))) { (xmlStrEqual(ctxt->name, BAD_CAST"html")))) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr,"htmlAutoClose: EOF closes %s\n", ctxt->name); fprintf(stderr,"htmlAutoClose: EOF closes %s\n", ctxt->name);
#endif #endif
@ -775,7 +775,7 @@ htmlAutoCloseTag(htmlDocPtr doc, const xmlChar *name, htmlNodePtr elem) {
htmlNodePtr child; htmlNodePtr child;
if (elem == NULL) return(1); if (elem == NULL) return(1);
if (!xmlStrcmp(name, elem->name)) return(0); if (xmlStrEqual(name, elem->name)) return(0);
if (htmlCheckAutoClose(elem->name, name)) return(1); if (htmlCheckAutoClose(elem->name, name)) return(1);
child = elem->children; child = elem->children;
while (child != NULL) { while (child != NULL) {
@ -820,7 +820,7 @@ htmlIsAutoClosed(htmlDocPtr doc, htmlNodePtr elem) {
*/ */
void void
htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) { htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
if (!xmlStrcmp(newtag, BAD_CAST"html")) if (xmlStrEqual(newtag, BAD_CAST"html"))
return; return;
if (ctxt->nameNr <= 0) { if (ctxt->nameNr <= 0) {
#ifdef DEBUG #ifdef DEBUG
@ -830,15 +830,15 @@ htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL))
ctxt->sax->startElement(ctxt->userData, BAD_CAST"html", NULL); ctxt->sax->startElement(ctxt->userData, BAD_CAST"html", NULL);
} }
if ((!xmlStrcmp(newtag, BAD_CAST"body")) || (!xmlStrcmp(newtag, BAD_CAST"head"))) if ((xmlStrEqual(newtag, BAD_CAST"body")) || (xmlStrEqual(newtag, BAD_CAST"head")))
return; return;
if (ctxt->nameNr <= 1) { if (ctxt->nameNr <= 1) {
if ((!xmlStrcmp(newtag, BAD_CAST"script")) || if ((xmlStrEqual(newtag, BAD_CAST"script")) ||
(!xmlStrcmp(newtag, BAD_CAST"style")) || (xmlStrEqual(newtag, BAD_CAST"style")) ||
(!xmlStrcmp(newtag, BAD_CAST"meta")) || (xmlStrEqual(newtag, BAD_CAST"meta")) ||
(!xmlStrcmp(newtag, BAD_CAST"link")) || (xmlStrEqual(newtag, BAD_CAST"link")) ||
(!xmlStrcmp(newtag, BAD_CAST"title")) || (xmlStrEqual(newtag, BAD_CAST"title")) ||
(!xmlStrcmp(newtag, BAD_CAST"base"))) { (xmlStrEqual(newtag, BAD_CAST"base"))) {
/* /*
* dropped OBJECT ... i you put it first BODY will be * dropped OBJECT ... i you put it first BODY will be
* assumed ! * assumed !
@ -888,7 +888,7 @@ htmlCheckParagraph(htmlParserCtxtPtr ctxt) {
return(1); return(1);
} }
for (i = 0; htmlNoContentElements[i] != NULL; i++) { for (i = 0; htmlNoContentElements[i] != NULL; i++) {
if (!xmlStrcmp(tag, BAD_CAST htmlNoContentElements[i])) { if (xmlStrEqual(tag, BAD_CAST htmlNoContentElements[i])) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr,"Implied element paragraph\n"); fprintf(stderr,"Implied element paragraph\n");
#endif #endif
@ -1227,7 +1227,7 @@ htmlEntityLookup(const xmlChar *name) {
for (i = 0;i < (sizeof(html40EntitiesTable)/ for (i = 0;i < (sizeof(html40EntitiesTable)/
sizeof(html40EntitiesTable[0]));i++) { sizeof(html40EntitiesTable[0]));i++) {
if (!xmlStrcmp(name, BAD_CAST html40EntitiesTable[i].name)) { if (xmlStrEqual(name, BAD_CAST html40EntitiesTable[i].name)) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr,"Found entity %s\n", name); fprintf(stderr,"Found entity %s\n", name);
#endif #endif
@ -1650,11 +1650,11 @@ static int areBlanks(htmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
if (CUR != '<') return(0); if (CUR != '<') return(0);
if (ctxt->name == NULL) if (ctxt->name == NULL)
return(1); return(1);
if (!xmlStrcmp(ctxt->name, BAD_CAST"html")) if (xmlStrEqual(ctxt->name, BAD_CAST"html"))
return(1); return(1);
if (!xmlStrcmp(ctxt->name, BAD_CAST"head")) if (xmlStrEqual(ctxt->name, BAD_CAST"head"))
return(1); return(1);
if (!xmlStrcmp(ctxt->name, BAD_CAST"body")) if (xmlStrEqual(ctxt->name, BAD_CAST"body"))
return(1); return(1);
if (ctxt->node == NULL) return(0); if (ctxt->node == NULL) return(0);
lastChild = xmlGetLastChild(ctxt->node); lastChild = xmlGetLastChild(ctxt->node);
@ -2805,7 +2805,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
ctxt->wellFormed = 0; ctxt->wellFormed = 0;
return; return;
} }
if (!xmlStrcmp(name, BAD_CAST"meta")) if (xmlStrEqual(name, BAD_CAST"meta"))
meta = 1; meta = 1;
/* /*
@ -2837,7 +2837,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
* Well formedness requires at most one declaration of an attribute * Well formedness requires at most one declaration of an attribute
*/ */
for (i = 0; i < nbatts;i += 2) { for (i = 0; i < nbatts;i += 2) {
if (!xmlStrcmp(atts[i], attname)) { if (xmlStrEqual(atts[i], attname)) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData, ctxt->sax->error(ctxt->userData,
"Attribute %s redefined\n", "Attribute %s redefined\n",
@ -2962,7 +2962,7 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt) {
* then return, it's just an error. * then return, it's just an error.
*/ */
for (i = (ctxt->nameNr - 1);i >= 0;i--) { for (i = (ctxt->nameNr - 1);i >= 0;i--) {
if (!xmlStrcmp(name, ctxt->nameTab[i])) break; if (xmlStrEqual(name, ctxt->nameTab[i])) break;
} }
if (i < 0) { if (i < 0) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
@ -2985,12 +2985,12 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt) {
* With the exception that the autoclose may have popped stuff out * With the exception that the autoclose may have popped stuff out
* of the stack. * of the stack.
*/ */
if (xmlStrcmp(name, ctxt->name)) { if (!xmlStrEqual(name, ctxt->name)) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr,"End of tag %s: expecting %s\n", name, ctxt->name); fprintf(stderr,"End of tag %s: expecting %s\n", name, ctxt->name);
#endif #endif
if ((ctxt->name != NULL) && if ((ctxt->name != NULL) &&
(xmlStrcmp(ctxt->name, name))) { (!xmlStrEqual(ctxt->name, name))) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData, ctxt->sax->error(ctxt->userData,
"Opening and ending tag mismatch: %s and %s\n", "Opening and ending tag mismatch: %s and %s\n",
@ -3003,7 +3003,7 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt) {
* SAX: End of Tag * SAX: End of Tag
*/ */
oldname = ctxt->name; oldname = ctxt->name;
if ((oldname != NULL) && (!xmlStrcmp(oldname, name))) { if ((oldname != NULL) && (xmlStrEqual(oldname, name))) {
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
ctxt->sax->endElement(ctxt->userData, name); ctxt->sax->endElement(ctxt->userData, name);
oldname = htmlnamePop(ctxt); oldname = htmlnamePop(ctxt);
@ -3134,7 +3134,7 @@ htmlParseContent(htmlParserCtxtPtr ctxt) {
* Has this node been popped out during parsing of * Has this node been popped out during parsing of
* the next element * the next element
*/ */
if ((xmlStrcmp(currentNode, ctxt->name)) && if ((!xmlStrEqual(currentNode, ctxt->name)) &&
(depth >= ctxt->nameNr)) { (depth >= ctxt->nameNr)) {
if (currentNode != NULL) xmlFree(currentNode); if (currentNode != NULL) xmlFree(currentNode);
return; return;
@ -3245,7 +3245,7 @@ htmlParseElement(htmlParserCtxtPtr ctxt) {
else else
fprintf(stderr, "Start of element %s, was %s\n", name, oldname); fprintf(stderr, "Start of element %s, was %s\n", name, oldname);
#endif #endif
if (((depth == ctxt->nameNr) && (!xmlStrcmp(oldname, ctxt->name))) || if (((depth == ctxt->nameNr) && (xmlStrEqual(oldname, ctxt->name))) ||
(name == NULL)) { (name == NULL)) {
if (CUR == '>') if (CUR == '>')
NEXT; NEXT;
@ -3301,7 +3301,7 @@ htmlParseElement(htmlParserCtxtPtr ctxt) {
/* /*
* end of parsing of this node. * end of parsing of this node.
*/ */
if (!xmlStrcmp(name, ctxt->name)) { if (xmlStrEqual(name, ctxt->name)) {
nodePop(ctxt); nodePop(ctxt);
oldname = htmlnamePop(ctxt); oldname = htmlnamePop(ctxt);
#ifdef DEBUG #ifdef DEBUG
@ -3993,7 +3993,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
name, oldname); name, oldname);
#endif #endif
if (((depth == ctxt->nameNr) && if (((depth == ctxt->nameNr) &&
(!xmlStrcmp(oldname, ctxt->name))) || (xmlStrEqual(oldname, ctxt->name))) ||
(name == NULL)) { (name == NULL)) {
if (CUR == '>') if (CUR == '>')
NEXT; NEXT;
@ -4055,7 +4055,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
/* /*
* end of parsing of this node. * end of parsing of this node.
*/ */
if (!xmlStrcmp(name, ctxt->name)) { if (xmlStrEqual(name, ctxt->name)) {
nodePop(ctxt); nodePop(ctxt);
oldname = htmlnamePop(ctxt); oldname = htmlnamePop(ctxt);
#ifdef DEBUG #ifdef DEBUG

View File

@ -61,11 +61,11 @@ htmlGetMetaEncoding(htmlDocPtr doc) {
*/ */
while (cur != NULL) { while (cur != NULL) {
if (cur->name != NULL) { if (cur->name != NULL) {
if (!xmlStrcmp(cur->name, BAD_CAST"html")) if (xmlStrEqual(cur->name, BAD_CAST"html"))
break; break;
if (!xmlStrcmp(cur->name, BAD_CAST"head")) if (xmlStrEqual(cur->name, BAD_CAST"head"))
goto found_head; goto found_head;
if (!xmlStrcmp(cur->name, BAD_CAST"meta")) if (xmlStrEqual(cur->name, BAD_CAST"meta"))
goto found_meta; goto found_meta;
} }
cur = cur->next; cur = cur->next;
@ -79,9 +79,9 @@ htmlGetMetaEncoding(htmlDocPtr doc) {
*/ */
while (cur != NULL) { while (cur != NULL) {
if (cur->name != NULL) { if (cur->name != NULL) {
if (!xmlStrcmp(cur->name, BAD_CAST"head")) if (xmlStrEqual(cur->name, BAD_CAST"head"))
break; break;
if (!xmlStrcmp(cur->name, BAD_CAST"meta")) if (xmlStrEqual(cur->name, BAD_CAST"meta"))
goto found_meta; goto found_meta;
} }
cur = cur->next; cur = cur->next;
@ -97,7 +97,7 @@ found_head:
found_meta: found_meta:
while (cur != NULL) { while (cur != NULL) {
if (cur->name != NULL) { if (cur->name != NULL) {
if (!xmlStrcmp(cur->name, BAD_CAST"meta")) { if (xmlStrEqual(cur->name, BAD_CAST"meta")) {
xmlAttrPtr attr = cur->properties; xmlAttrPtr attr = cur->properties;
int http; int http;
const xmlChar *value; const xmlChar *value;
@ -191,9 +191,9 @@ htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) {
*/ */
while (cur != NULL) { while (cur != NULL) {
if (cur->name != NULL) { if (cur->name != NULL) {
if (!xmlStrcmp(cur->name, BAD_CAST"html")) if (xmlStrEqual(cur->name, BAD_CAST"html"))
break; break;
if (!xmlStrcmp(cur->name, BAD_CAST"body")) { if (xmlStrEqual(cur->name, BAD_CAST"body")) {
if (encoding == NULL) if (encoding == NULL)
return(0); return(0);
meta = xmlNewDocNode(doc, NULL, BAD_CAST"head", NULL); meta = xmlNewDocNode(doc, NULL, BAD_CAST"head", NULL);
@ -205,9 +205,9 @@ htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) {
xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent); xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent);
return(0); return(0);
} }
if (!xmlStrcmp(cur->name, BAD_CAST"head")) if (xmlStrEqual(cur->name, BAD_CAST"head"))
goto found_head; goto found_head;
if (!xmlStrcmp(cur->name, BAD_CAST"meta")) if (xmlStrEqual(cur->name, BAD_CAST"meta"))
goto found_meta; goto found_meta;
} }
cur = cur->next; cur = cur->next;
@ -221,9 +221,9 @@ htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) {
*/ */
while (cur != NULL) { while (cur != NULL) {
if (cur->name != NULL) { if (cur->name != NULL) {
if (!xmlStrcmp(cur->name, BAD_CAST"head")) if (xmlStrEqual(cur->name, BAD_CAST"head"))
break; break;
if (!xmlStrcmp(cur->name, BAD_CAST"body")) { if (xmlStrEqual(cur->name, BAD_CAST"body")) {
if (encoding == NULL) if (encoding == NULL)
return(0); return(0);
meta = xmlNewDocNode(doc, NULL, BAD_CAST"head", NULL); meta = xmlNewDocNode(doc, NULL, BAD_CAST"head", NULL);
@ -235,7 +235,7 @@ htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) {
xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent); xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent);
return(0); return(0);
} }
if (!xmlStrcmp(cur->name, BAD_CAST"meta")) if (xmlStrEqual(cur->name, BAD_CAST"meta"))
goto found_meta; goto found_meta;
} }
cur = cur->next; cur = cur->next;
@ -272,7 +272,7 @@ found_meta:
*/ */
while (cur != NULL) { while (cur != NULL) {
if (cur->name != NULL) { if (cur->name != NULL) {
if (!xmlStrcmp(cur->name, BAD_CAST"meta")) { if (xmlStrEqual(cur->name, BAD_CAST"meta")) {
xmlAttrPtr attr = cur->properties; xmlAttrPtr attr = cur->properties;
int http; int http;
const xmlChar *value; const xmlChar *value;

2
SAX.c
View File

@ -1387,7 +1387,7 @@ checkNamespace(void *ctx, xmlChar *namespace)
"End tags %s holds a prefix %s not used by the open tag\n", "End tags %s holds a prefix %s not used by the open tag\n",
cur->name, namespace); cur->name, namespace);
ctxt->wellFormed = 0; ctxt->wellFormed = 0;
} else if (xmlStrcmp(namespace, cur->ns->prefix)) { } else if (!xmlStrEqual(namespace, cur->ns->prefix)) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt, ctxt->sax->error(ctxt,
"Start and End tags for %s don't use the same namespaces: %s and %s\n", "Start and End tags for %s don't use the same namespaces: %s and %s\n",

11
TODO
View File

@ -6,19 +6,11 @@
TODO: TODO:
===== =====
- cleanup the mess with URI references when composing entities.
- performances: there is still improvements needed when parsing Docbook DTD - performances: there is still improvements needed when parsing Docbook DTD
a single function to optimize/avoid. a single function to optimize/avoid.
- Moving all deprecated functions to a different module, allow to compile
it out.
- DOM needs - DOM needs
int xmlPruneProp(xmlNodePtr node, xmlAtttrPtr attr); int xmlPruneProp(xmlNodePtr node, xmlAtttrPtr attr);
- listing all attributes in a node. - listing all attributes in a node.
- General checking of DTD validation in presence of namespaces ... hairy
mostly done
- Fix DTD + namespace validity problem
"Not valid: root and DtD name do not match 'ROOT' and 'prefix:ROOT'"
mostly done
- Correct standalone checking/emitting (hard) - Correct standalone checking/emitting (hard)
2.9 Standalone Document Declaration 2.9 Standalone Document Declaration
- Better checking of external parsed entities TAG 1234 - Better checking of external parsed entities TAG 1234
@ -38,6 +30,9 @@ TODO:
- jamesh suggestion: SAX like functions to save a document ie. call a - jamesh suggestion: SAX like functions to save a document ie. call a
function to open a new element with given attributes, write character function to open a new element with given attributes, write character
data, close last element, etc data, close last element, etc
- HTML: handling of Script data elements/attributes, need special code in
the parser and saving functions (handling of < > " ' ...):
http://www.w3.org/TR/html4/types.html#type-script
TODO: TODO:
===== =====

View File

@ -6,7 +6,7 @@ AC_CANONICAL_HOST
LIBXML_MAJOR_VERSION=2 LIBXML_MAJOR_VERSION=2
LIBXML_MINOR_VERSION=2 LIBXML_MINOR_VERSION=2
LIBXML_MICRO_VERSION=3 LIBXML_MICRO_VERSION=4
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION

View File

@ -1491,14 +1491,14 @@ xmlShellPwd(xmlShellCtxtPtr ctxt, char *buffer, xmlNodePtr node,
*/ */
tmp = cur->prev; tmp = cur->prev;
while (tmp != NULL) { while (tmp != NULL) {
if (!xmlStrcmp(cur->name, tmp->name)) if (xmlStrEqual(cur->name, tmp->name))
occur++; occur++;
tmp = tmp->prev; tmp = tmp->prev;
} }
if (occur == 0) { if (occur == 0) {
tmp = cur->next; tmp = cur->next;
while (tmp != NULL) { while (tmp != NULL) {
if (!xmlStrcmp(cur->name, tmp->name)) if (xmlStrEqual(cur->name, tmp->name))
occur++; occur++;
tmp = tmp->next; tmp = tmp->next;
} }

View File

@ -114,7 +114,7 @@ xmlAddEntity(xmlEntitiesTablePtr table, const xmlChar *name, int type,
hash = xmlEntityComputeHash(name); hash = xmlEntityComputeHash(name);
ret = table->table[hash]; ret = table->table[hash];
while (ret != NULL) { while (ret != NULL) {
if (!xmlStrcmp(ret->name, name)) { if (xmlStrEqual(ret->name, name)) {
/* /*
* The entity is already defined in this Dtd, the spec says to NOT * The entity is already defined in this Dtd, the spec says to NOT
* override it ... Is it worth a Warning ??? !!! * override it ... Is it worth a Warning ??? !!!
@ -137,7 +137,7 @@ xmlAddEntity(xmlEntitiesTablePtr table, const xmlChar *name, int type,
#else #else
for (i = 0;i < table->nb_entities;i++) { for (i = 0;i < table->nb_entities;i++) {
ret = table->table[i]; ret = table->table[i];
if (!xmlStrcmp(ret->name, name)) { if (xmlStrEqual(ret->name, name)) {
/* /*
* The entity is already defined in this Dtd, the spec says to NOT * The entity is already defined in this Dtd, the spec says to NOT
* override it ... Is it worth a Warning ??? !!! * override it ... Is it worth a Warning ??? !!!
@ -268,14 +268,14 @@ xmlGetPredefinedEntity(const xmlChar *name) {
i = xmlEntityComputeHash(name); i = xmlEntityComputeHash(name);
cur = xmlPredefinedEntities->table[i]; cur = xmlPredefinedEntities->table[i];
while (cur != NULL) { while (cur != NULL) {
if (!xmlStrcmp(cur->name, name)) if (xmlStrEqual(cur->name, name))
return(cur); return(cur);
cur = cur->nexte; cur = cur->nexte;
} }
#else #else
for (i = 0;i < xmlPredefinedEntities->nb_entities;i++) { for (i = 0;i < xmlPredefinedEntities->nb_entities;i++) {
cur = xmlPredefinedEntities->table[i]; cur = xmlPredefinedEntities->table[i];
if (!xmlStrcmp(cur->name, name)) return(cur); if (xmlStrEqual(cur->name, name)) return(cur);
} }
#endif #endif
return(NULL); return(NULL);
@ -425,7 +425,7 @@ xmlEntityCheckReference(xmlEntityPtr ent, const xmlChar *to) {
for (i = 0;i < ent->entNr;i++) { for (i = 0;i < ent->entNr;i++) {
xmlEntityPtr indir = NULL; xmlEntityPtr indir = NULL;
if (!xmlStrcmp(to, ent->entTab[i])) if (xmlStrEqual(to, ent->entTab[i]))
return(1); return(1);
switch (ent->etype) { switch (ent->etype) {
@ -485,7 +485,7 @@ xmlEntityAddReference(xmlEntityPtr ent, const xmlChar *to) {
} }
for (i = 0;i < ent->entNr;i++) { for (i = 0;i < ent->entNr;i++) {
if (!xmlStrcmp(to, ent->entTab[i])) if (xmlStrEqual(to, ent->entTab[i]))
return(0); return(0);
} }
@ -552,10 +552,10 @@ xmlGetEntityFromTable(xmlEntitiesTablePtr table, const xmlChar *name,
switch (cur->etype) { switch (cur->etype) {
case XML_INTERNAL_PARAMETER_ENTITY: case XML_INTERNAL_PARAMETER_ENTITY:
case XML_EXTERNAL_PARAMETER_ENTITY: case XML_EXTERNAL_PARAMETER_ENTITY:
if ((parameter) && (!xmlStrcmp(cur->name, name))) if ((parameter) && (xmlStrEqual(cur->name, name)))
return(cur); return(cur);
default: default:
if ((!parameter) && (!xmlStrcmp(cur->name, name))) if ((!parameter) && (xmlStrEqual(cur->name, name)))
return(cur); return(cur);
} }
cur = cur->nexte; cur = cur->nexte;
@ -568,10 +568,10 @@ xmlGetEntityFromTable(xmlEntitiesTablePtr table, const xmlChar *name,
switch (cur->etype) { switch (cur->etype) {
case XML_INTERNAL_PARAMETER_ENTITY: case XML_INTERNAL_PARAMETER_ENTITY:
case XML_EXTERNAL_PARAMETER_ENTITY: case XML_EXTERNAL_PARAMETER_ENTITY:
if ((parameter) && (!xmlStrcmp(cur->name, name))) if ((parameter) && (xmlStrEqual(cur->name, name)))
return(cur); return(cur);
default: default:
if ((!parameter) && (!xmlStrcmp(cur->name, name))) if ((!parameter) && (xmlStrEqual(cur->name, name)))
return(cur); return(cur);
} }
} }

View File

@ -348,6 +348,8 @@ int xmlStrcasecmp (const xmlChar *str1,
int xmlStrncasecmp (const xmlChar *str1, int xmlStrncasecmp (const xmlChar *str1,
const xmlChar *str2, const xmlChar *str2,
int len); int len);
int xmlStrEqual (const xmlChar *str1,
const xmlChar *str2);
int xmlStrlen (const xmlChar *str); int xmlStrlen (const xmlChar *str);
xmlChar * xmlStrcat (xmlChar *cur, xmlChar * xmlStrcat (xmlChar *cur,
const xmlChar *add); const xmlChar *add);

View File

@ -1020,6 +1020,28 @@ xmlStrcmp(const xmlChar *str1, const xmlChar *str2) {
return 0; return 0;
} }
/**
* xmlStrEqual:
* @str1: the first xmlChar *
* @str2: the second xmlChar *
*
* Check if both string are equal of have same content
* Should be a bit more readable and faster than xmlStrEqual()
*
* Returns 1 if they are equal, 0 if they are different
*/
int
xmlStrEqual(const xmlChar *str1, const xmlChar *str2) {
if (str1 == str2) return(1);
if (str1 == NULL) return(0);
if (str2 == NULL) return(0);
do {
if (*str1++ != *str2) return(0);
} while (*str2++);
return(1);
}
/** /**
* xmlStrncmp: * xmlStrncmp:
* @str1: the first xmlChar * * @str1: the first xmlChar *
@ -2649,7 +2671,7 @@ xmlParsePITarget(xmlParserCtxtPtr ctxt) {
} }
for (i = 0;;i++) { for (i = 0;;i++) {
if (xmlW3CPIs[i] == NULL) break; if (xmlW3CPIs[i] == NULL) break;
if (!xmlStrcmp(name, (const xmlChar *)xmlW3CPIs[i])) if (xmlStrEqual(name, (const xmlChar *)xmlW3CPIs[i]))
return(name); return(name);
} }
if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) { if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) {
@ -4696,7 +4718,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
*/ */
if ((value != NULL) && if ((value != NULL) &&
(value[1] == 0) && (value[0] == '<') && (value[1] == 0) && (value[0] == '<') &&
(!xmlStrcmp(ent->name, BAD_CAST "lt"))) { (xmlStrEqual(ent->name, BAD_CAST "lt"))) {
/* /*
* DONE: get definite answer on this !!! * DONE: get definite answer on this !!!
* Lots of entity decls are used to declare a single * Lots of entity decls are used to declare a single
@ -4991,7 +5013,7 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
*/ */
else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) && else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
(ent != NULL) && (ent != NULL) &&
(xmlStrcmp(ent->name, BAD_CAST "lt")) && (!xmlStrEqual(ent->name, BAD_CAST "lt")) &&
(ent->content != NULL) && (ent->content != NULL) &&
(xmlStrchr(ent->content, '<'))) { (xmlStrchr(ent->content, '<'))) {
ctxt->errNo = XML_ERR_LT_IN_ATTRIBUTE; ctxt->errNo = XML_ERR_LT_IN_ATTRIBUTE;
@ -5183,7 +5205,7 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
*/ */
else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) && else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
(ent != NULL) && (ent != NULL) &&
(xmlStrcmp(ent->name, BAD_CAST "lt")) && (!xmlStrEqual(ent->name, BAD_CAST "lt")) &&
(ent->content != NULL) && (ent->content != NULL) &&
(xmlStrchr(ent->content, '<'))) { (xmlStrchr(ent->content, '<'))) {
ctxt->errNo = XML_ERR_LT_IN_ATTRIBUTE; ctxt->errNo = XML_ERR_LT_IN_ATTRIBUTE;
@ -5710,7 +5732,7 @@ xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlChar **value) {
* No more registered as an error, just generate a warning now * No more registered as an error, just generate a warning now
* since this was deprecated in XML second edition * since this was deprecated in XML second edition
*/ */
if ((ctxt->pedantic) && (!xmlStrcmp(name, BAD_CAST "xml:lang"))) { if ((ctxt->pedantic) && (xmlStrEqual(name, BAD_CAST "xml:lang"))) {
if (!xmlCheckLanguageID(val)) { if (!xmlCheckLanguageID(val)) {
if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
ctxt->sax->warning(ctxt->userData, ctxt->sax->warning(ctxt->userData,
@ -5721,10 +5743,10 @@ xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlChar **value) {
/* /*
* Check that xml:space conforms to the specification * Check that xml:space conforms to the specification
*/ */
if (!xmlStrcmp(name, BAD_CAST "xml:space")) { if (xmlStrEqual(name, BAD_CAST "xml:space")) {
if (!xmlStrcmp(val, BAD_CAST "default")) if (xmlStrEqual(val, BAD_CAST "default"))
*(ctxt->space) = 0; *(ctxt->space) = 0;
else if (!xmlStrcmp(val, BAD_CAST "preserve")) else if (xmlStrEqual(val, BAD_CAST "preserve"))
*(ctxt->space) = 1; *(ctxt->space) = 1;
else { else {
ctxt->errNo = XML_ERR_ATTRIBUTE_WITHOUT_VALUE; ctxt->errNo = XML_ERR_ATTRIBUTE_WITHOUT_VALUE;
@ -5815,7 +5837,7 @@ xmlParseStartTag(xmlParserCtxtPtr ctxt) {
* start-tag or empty-element tag. * start-tag or empty-element tag.
*/ */
for (i = 0; i < nbatts;i += 2) { for (i = 0; i < nbatts;i += 2) {
if (!xmlStrcmp(atts[i], attname)) { if (xmlStrEqual(atts[i], attname)) {
ctxt->errNo = XML_ERR_ATTRIBUTE_REDEFINED; ctxt->errNo = XML_ERR_ATTRIBUTE_REDEFINED;
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData, ctxt->sax->error(ctxt->userData,
@ -5952,7 +5974,7 @@ xmlParseEndTag(xmlParserCtxtPtr ctxt) {
* *
*/ */
if ((name == NULL) || (ctxt->name == NULL) || if ((name == NULL) || (ctxt->name == NULL) ||
(xmlStrcmp(name, ctxt->name))) { (!xmlStrEqual(name, ctxt->name))) {
ctxt->errNo = XML_ERR_TAG_NAME_MISMATCH; ctxt->errNo = XML_ERR_TAG_NAME_MISMATCH;
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) {
if ((name != NULL) && (ctxt->name != NULL)) { if ((name != NULL) && (ctxt->name != NULL)) {

View File

@ -348,6 +348,8 @@ int xmlStrcasecmp (const xmlChar *str1,
int xmlStrncasecmp (const xmlChar *str1, int xmlStrncasecmp (const xmlChar *str1,
const xmlChar *str2, const xmlChar *str2,
int len); int len);
int xmlStrEqual (const xmlChar *str1,
const xmlChar *str2);
int xmlStrlen (const xmlChar *str); int xmlStrlen (const xmlChar *str);
xmlChar * xmlStrcat (xmlChar *cur, xmlChar * xmlStrcat (xmlChar *cur,
const xmlChar *add); const xmlChar *add);

View File

@ -0,0 +1,9 @@
Object is a Node Set :
Set contains 1 nodes:
1 ELEMENT ITEM
ATTRIBUTE monto
TEXT
content=50.12
ATTRIBUTE divisa
TEXT
content=DOL

12
test/XPath/docs/usr1 Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<BODY>
<DECLARACION importador="123456789" fecha="08/09/2000"
monto_factura="100.09">
<ITEM monto="50.12" divisa="DOL">
<SUFIJO codigo="NL34" valor="negro"/>
<SUFIJO codigo="AS34" valor="grande"/>
</ITEM>
</DECLARACION>
<FIRMA>N</FIRMA>
</BODY>

View File

@ -0,0 +1 @@
//ITEM[1]

30
tree.c
View File

@ -164,14 +164,14 @@ xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix) {
xmlNsPtr prev = node->nsDef; xmlNsPtr prev = node->nsDef;
if (((prev->prefix == NULL) && (cur->prefix == NULL)) || if (((prev->prefix == NULL) && (cur->prefix == NULL)) ||
(!xmlStrcmp(prev->prefix, cur->prefix))) { (xmlStrEqual(prev->prefix, cur->prefix))) {
xmlFreeNs(cur); xmlFreeNs(cur);
return(NULL); return(NULL);
} }
while (prev->next != NULL) { while (prev->next != NULL) {
prev = prev->next; prev = prev->next;
if (((prev->prefix == NULL) && (cur->prefix == NULL)) || if (((prev->prefix == NULL) && (cur->prefix == NULL)) ||
(!xmlStrcmp(prev->prefix, cur->prefix))) { (xmlStrEqual(prev->prefix, cur->prefix))) {
xmlFreeNs(cur); xmlFreeNs(cur);
return(NULL); return(NULL);
} }
@ -2687,11 +2687,11 @@ xmlNodeGetSpacePreserve(xmlNodePtr cur) {
while (cur != NULL) { while (cur != NULL) {
space = xmlGetProp(cur, BAD_CAST "xml:space"); space = xmlGetProp(cur, BAD_CAST "xml:space");
if (space != NULL) { if (space != NULL) {
if (!xmlStrcmp(space, BAD_CAST "preserve")) { if (xmlStrEqual(space, BAD_CAST "preserve")) {
xmlFree(space); xmlFree(space);
return(1); return(1);
} }
if (!xmlStrcmp(space, BAD_CAST "default")) { if (xmlStrEqual(space, BAD_CAST "default")) {
xmlFree(space); xmlFree(space);
return(0); return(0);
} }
@ -3194,7 +3194,7 @@ xmlGetNsList(xmlDocPtr doc, xmlNodePtr node) {
} }
for (i = 0;i < nbns;i++) { for (i = 0;i < nbns;i++) {
if ((cur->prefix == ret[i]->prefix) || if ((cur->prefix == ret[i]->prefix) ||
(!xmlStrcmp(cur->prefix, ret[i]->prefix))) break; (xmlStrEqual(cur->prefix, ret[i]->prefix))) break;
} }
if (i >= nbns) { if (i >= nbns) {
if (nbns >= maxns) { if (nbns >= maxns) {
@ -3251,7 +3251,7 @@ xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) {
return(cur); return(cur);
if ((cur->prefix != NULL) && (nameSpace != NULL) && if ((cur->prefix != NULL) && (nameSpace != NULL) &&
(cur->href != NULL) && (cur->href != NULL) &&
(!xmlStrcmp(cur->prefix, nameSpace))) (xmlStrEqual(cur->prefix, nameSpace)))
return(cur); return(cur);
cur = cur->next; cur = cur->next;
} }
@ -3281,7 +3281,7 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar *href) {
cur = node->nsDef; cur = node->nsDef;
while (cur != NULL) { while (cur != NULL) {
if ((cur->href != NULL) && (href != NULL) && if ((cur->href != NULL) && (href != NULL) &&
(!xmlStrcmp(cur->href, href))) { (xmlStrEqual(cur->href, href))) {
/* /*
* Check that the prefix is not shadowed between orig and node * Check that the prefix is not shadowed between orig and node
*/ */
@ -3294,7 +3294,7 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar *href) {
if ((tst->prefix == NULL) && (cur->prefix == NULL)) if ((tst->prefix == NULL) && (cur->prefix == NULL))
goto shadowed; goto shadowed;
if ((tst->prefix != NULL) && (cur->prefix != NULL) && if ((tst->prefix != NULL) && (cur->prefix != NULL) &&
(!xmlStrcmp(tst->prefix, cur->prefix))) (xmlStrEqual(tst->prefix, cur->prefix)))
goto shadowed; goto shadowed;
tst = tst->next; tst = tst->next;
} }
@ -3576,7 +3576,7 @@ xmlHasProp(xmlNodePtr node, const xmlChar *name) {
*/ */
prop = node->properties; prop = node->properties;
while (prop != NULL) { while (prop != NULL) {
if (!xmlStrcmp(prop->name, name)) { if (xmlStrEqual(prop->name, name)) {
return(prop); return(prop);
} }
prop = prop->next; prop = prop->next;
@ -3625,7 +3625,7 @@ xmlGetProp(xmlNodePtr node, const xmlChar *name) {
*/ */
prop = node->properties; prop = node->properties;
while (prop != NULL) { while (prop != NULL) {
if (!xmlStrcmp(prop->name, name)) { if (xmlStrEqual(prop->name, name)) {
xmlChar *ret; xmlChar *ret;
ret = xmlNodeListGetString(node->doc, prop->children, 1); ret = xmlNodeListGetString(node->doc, prop->children, 1);
@ -3685,10 +3685,10 @@ xmlGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *namespace) {
* or * or
* no namespace on the attribute and the element carrying it * no namespace on the attribute and the element carrying it
*/ */
if ((!xmlStrcmp(prop->name, name)) && if ((xmlStrEqual(prop->name, name)) &&
(((prop->ns == NULL) && (node->ns != NULL) && (((prop->ns == NULL) && (node->ns != NULL) &&
(!xmlStrcmp(node->ns->href, namespace))) || (xmlStrEqual(node->ns->href, namespace))) ||
((prop->ns != NULL) && (!xmlStrcmp(prop->ns->href, namespace))))) { ((prop->ns != NULL) && (xmlStrEqual(prop->ns->href, namespace))))) {
xmlChar *ret; xmlChar *ret;
ret = xmlNodeListGetString(node->doc, prop->children, 1); ret = xmlNodeListGetString(node->doc, prop->children, 1);
@ -3716,7 +3716,7 @@ xmlGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *namespace) {
* The DTD declaration only allows a prefix search * The DTD declaration only allows a prefix search
*/ */
ns = xmlSearchNs(doc, node, attrDecl->prefix); ns = xmlSearchNs(doc, node, attrDecl->prefix);
if ((ns != NULL) && (!xmlStrcmp(ns->href, namespace))) if ((ns != NULL) && (xmlStrEqual(ns->href, namespace)))
return(xmlStrdup(attrDecl->defaultValue)); return(xmlStrdup(attrDecl->defaultValue));
} }
} }
@ -3738,7 +3738,7 @@ xmlSetProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) {
xmlAttrPtr prop = node->properties; xmlAttrPtr prop = node->properties;
while (prop != NULL) { while (prop != NULL) {
if (!xmlStrcmp(prop->name, name)) { if (xmlStrEqual(prop->name, name)) {
if (prop->children != NULL) if (prop->children != NULL)
xmlFreeNodeList(prop->children); xmlFreeNodeList(prop->children);
prop->children = NULL; prop->children = NULL;

106
valid.c
View File

@ -567,8 +567,8 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name,
cur = table->table[i]; cur = table->table[i];
if ((ns != NULL) && (cur->prefix == NULL)) continue; if ((ns != NULL) && (cur->prefix == NULL)) continue;
if ((ns == NULL) && (cur->prefix != NULL)) continue; if ((ns == NULL) && (cur->prefix != NULL)) continue;
if ((!xmlStrcmp(cur->name, name)) && if ((xmlStrEqual(cur->name, name)) &&
((ns == NULL) || (!xmlStrcmp(cur->prefix, ns)))) { ((ns == NULL) || (xmlStrEqual(cur->prefix, ns)))) {
/* /*
* The element is already defined in this Dtd. * The element is already defined in this Dtd.
*/ */
@ -927,7 +927,7 @@ xmlScanAttributeDecl(xmlDtdPtr dtd, const xmlChar *elem) {
return(NULL); return(NULL);
for (i = 0;i < table->nb_attributes;i++) { for (i = 0;i < table->nb_attributes;i++) {
if (!xmlStrcmp(table->table[i]->elem, elem)) { if (xmlStrEqual(table->table[i]->elem, elem)) {
table->table[i]->nexth = ret; table->table[i]->nexth = ret;
ret = table->table[i]; ret = table->table[i];
} }
@ -1080,8 +1080,8 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem,
cur = cur->nexth; cur = cur->nexth;
continue; continue;
} }
if ((!xmlStrcmp(cur->name, name)) && if ((xmlStrEqual(cur->name, name)) &&
((ns == NULL) || (!xmlStrcmp(cur->prefix, ns)))) { ((ns == NULL) || (xmlStrEqual(cur->prefix, ns)))) {
/* /*
* The attribute is already defined in this Dtd. * The attribute is already defined in this Dtd.
*/ */
@ -1101,9 +1101,9 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem,
cur = table->table[i]; cur = table->table[i];
if ((ns != NULL) && (cur->prefix == NULL)) continue; if ((ns != NULL) && (cur->prefix == NULL)) continue;
if ((ns == NULL) && (cur->prefix != NULL)) continue; if ((ns == NULL) && (cur->prefix != NULL)) continue;
if ((!xmlStrcmp(cur->name, name)) && if ((xmlStrEqual(cur->name, name)) &&
(!xmlStrcmp(cur->elem, elem)) && (xmlStrEqual(cur->elem, elem)) &&
((ns == NULL) || (!xmlStrcmp(cur->prefix, ns)))) { ((ns == NULL) || (xmlStrEqual(cur->prefix, ns)))) {
/* /*
* The attribute is already defined in this Dtd. * The attribute is already defined in this Dtd.
*/ */
@ -1461,7 +1461,7 @@ xmlAddNotationDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name,
*/ */
for (i = 0;i < table->nb_notations;i++) { for (i = 0;i < table->nb_notations;i++) {
cur = table->table[i]; cur = table->table[i];
if (!xmlStrcmp(cur->name, name)) { if (xmlStrEqual(cur->name, name)) {
/* /*
* The notation is already defined in this Dtd. * The notation is already defined in this Dtd.
*/ */
@ -1730,7 +1730,7 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
*/ */
for (i = 0;i < table->nb_ids;i++) { for (i = 0;i < table->nb_ids;i++) {
cur = table->table[i]; cur = table->table[i];
if (!xmlStrcmp(cur->value, value)) { if (xmlStrEqual(cur->value, value)) {
/* /*
* The id is already defined in this Dtd. * The id is already defined in this Dtd.
*/ */
@ -1827,8 +1827,8 @@ xmlIsID(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) {
((attr->name[1] == 'D') || (attr->name[1] == 'd')) && ((attr->name[1] == 'D') || (attr->name[1] == 'd')) &&
(attr->name[2] == 0)) return(1); (attr->name[2] == 0)) return(1);
} else if (doc->type == XML_HTML_DOCUMENT_NODE) { } else if (doc->type == XML_HTML_DOCUMENT_NODE) {
if ((!xmlStrcmp(BAD_CAST "id", attr->name)) || if ((xmlStrEqual(BAD_CAST "id", attr->name)) ||
(!xmlStrcmp(BAD_CAST "name", attr->name))) (xmlStrEqual(BAD_CAST "name", attr->name)))
return(1); return(1);
return(0); return(0);
} else { } else {
@ -1916,7 +1916,7 @@ xmlGetID(xmlDocPtr doc, const xmlChar *ID) {
*/ */
for (i = 0;i < table->nb_ids;i++) { for (i = 0;i < table->nb_ids;i++) {
cur = table->table[i]; cur = table->table[i];
if (!xmlStrcmp(cur->value, ID)) { if (xmlStrEqual(cur->value, ID)) {
return(cur->attr); return(cur->attr);
} }
} }
@ -2177,7 +2177,7 @@ xmlGetRef(xmlDocPtr doc, const xmlChar *Ref) {
*/ */
for (i = 0;i < table->nb_refs;i++) { for (i = 0;i < table->nb_refs;i++) {
cur = table->table[i]; cur = table->table[i];
if (!xmlStrcmp(cur->value, Ref)) { if (xmlStrEqual(cur->value, Ref)) {
return(cur->attr); return(cur->attr);
} }
} }
@ -2213,12 +2213,12 @@ xmlGetDtdElementDesc(xmlDtdPtr dtd, const xmlChar *name) {
if ((table->last >= 0) && (table->last < table->nb_elements)) { if ((table->last >= 0) && (table->last < table->nb_elements)) {
cur = table->table[table->last]; cur = table->table[table->last];
if (!xmlStrcmp(cur->name, name)) if (xmlStrEqual(cur->name, name))
return(cur); return(cur);
} }
for (i = 0;i < table->nb_elements;i++) { for (i = 0;i < table->nb_elements;i++) {
cur = table->table[i]; cur = table->table[i];
if (!xmlStrcmp(cur->name, name)) { if (xmlStrEqual(cur->name, name)) {
table->last = i; table->last = i;
return(cur); return(cur);
} }
@ -2232,10 +2232,10 @@ xmlGetDtdElementDesc(xmlDtdPtr dtd, const xmlChar *name) {
for (i = 0;i < table->nb_elements;i++) { for (i = 0;i < table->nb_elements;i++) {
cur = table->table[i]; cur = table->table[i];
if ((!xmlStrcmp(cur->name, uqname)) && if ((xmlStrEqual(cur->name, uqname)) &&
((prefix == cur->prefix) || ((prefix == cur->prefix) ||
((prefix != NULL) && (cur->prefix != NULL) && ((prefix != NULL) && (cur->prefix != NULL) &&
(!xmlStrcmp(cur->prefix, prefix))))) { (xmlStrEqual(cur->prefix, prefix))))) {
if (prefix != NULL) xmlFree(prefix); if (prefix != NULL) xmlFree(prefix);
if (uqname != NULL) xmlFree(uqname); if (uqname != NULL) xmlFree(uqname);
return(cur); return(cur);
@ -2270,10 +2270,10 @@ xmlGetDtdQElementDesc(xmlDtdPtr dtd, const xmlChar *name,
for (i = 0;i < table->nb_elements;i++) { for (i = 0;i < table->nb_elements;i++) {
cur = table->table[i]; cur = table->table[i];
if (!xmlStrcmp(cur->name, name) && if (xmlStrEqual(cur->name, name) &&
((prefix == cur->prefix) || ((prefix == cur->prefix) ||
((prefix != NULL) && (cur->prefix != NULL) && ((prefix != NULL) && (cur->prefix != NULL) &&
(!xmlStrcmp(cur->prefix, prefix))))) (xmlStrEqual(cur->prefix, prefix)))))
return(cur); return(cur);
} }
return(NULL); return(NULL);
@ -2310,10 +2310,10 @@ xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name) {
if (etable != NULL) { if (etable != NULL) {
for (i = 0;i < etable->nb_elements;i++) { for (i = 0;i < etable->nb_elements;i++) {
ecur = etable->table[i]; ecur = etable->table[i];
if (!xmlStrcmp(ecur->name, elem)) { if (xmlStrEqual(ecur->name, elem)) {
cur = ecur->attributes; cur = ecur->attributes;
while (cur != NULL) { while (cur != NULL) {
if (!xmlStrcmp(cur->name, name)) if (xmlStrEqual(cur->name, name))
return(cur); return(cur);
cur = cur->nexth; cur = cur->nexth;
} }
@ -2331,8 +2331,8 @@ xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name) {
return(NULL); return(NULL);
for (i = 0;i < table->nb_attributes;i++) { for (i = 0;i < table->nb_attributes;i++) {
cur = table->table[i]; cur = table->table[i];
if ((!xmlStrcmp(cur->name, name)) && if ((xmlStrEqual(cur->name, name)) &&
(!xmlStrcmp(cur->elem, elem))) (xmlStrEqual(cur->elem, elem)))
return(cur); return(cur);
} }
@ -2344,11 +2344,11 @@ xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name) {
for (i = 0;i < table->nb_attributes;i++) { for (i = 0;i < table->nb_attributes;i++) {
cur = table->table[i]; cur = table->table[i];
if ((!xmlStrcmp(cur->name, uqname)) && if ((xmlStrEqual(cur->name, uqname)) &&
(!xmlStrcmp(cur->elem, elem)) && (xmlStrEqual(cur->elem, elem)) &&
((prefix == cur->prefix) || ((prefix == cur->prefix) ||
((prefix != NULL) && (cur->prefix != NULL) && ((prefix != NULL) && (cur->prefix != NULL) &&
(!xmlStrcmp(cur->prefix, prefix))))) { (xmlStrEqual(cur->prefix, prefix))))) {
if (prefix != NULL) xmlFree(prefix); if (prefix != NULL) xmlFree(prefix);
if (uqname != NULL) xmlFree(uqname); if (uqname != NULL) xmlFree(uqname);
return(cur); return(cur);
@ -2385,11 +2385,11 @@ xmlGetDtdQAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name,
for (i = 0;i < table->nb_attributes;i++) { for (i = 0;i < table->nb_attributes;i++) {
cur = table->table[i]; cur = table->table[i];
if ((!xmlStrcmp(cur->name, name)) && if ((xmlStrEqual(cur->name, name)) &&
(!xmlStrcmp(cur->elem, elem)) && (xmlStrEqual(cur->elem, elem)) &&
((prefix == cur->prefix) || ((prefix == cur->prefix) ||
((prefix != NULL) && (cur->prefix != NULL) && ((prefix != NULL) && (cur->prefix != NULL) &&
(!xmlStrcmp(cur->prefix, prefix))))) (xmlStrEqual(cur->prefix, prefix)))))
return(cur); return(cur);
} }
return(NULL); return(NULL);
@ -2417,7 +2417,7 @@ xmlGetDtdNotationDesc(xmlDtdPtr dtd, const xmlChar *name) {
for (i = 0;i < table->nb_notations;i++) { for (i = 0;i < table->nb_notations;i++) {
cur = table->table[i]; cur = table->table[i];
if (!xmlStrcmp(cur->name, name)) if (xmlStrEqual(cur->name, name))
return(cur); return(cur);
} }
return(NULL); return(NULL);
@ -2988,7 +2988,7 @@ xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
if (table != NULL) { if (table != NULL) {
for (i = 0;i < table->nb_attributes;i++) { for (i = 0;i < table->nb_attributes;i++) {
if ((table->table[i]->atype == XML_ATTRIBUTE_ID) && if ((table->table[i]->atype == XML_ATTRIBUTE_ID) &&
(!xmlStrcmp(table->table[i]->elem, attr->elem))) { (xmlStrEqual(table->table[i]->elem, attr->elem))) {
nbId++; nbId++;
} }
} }
@ -3020,7 +3020,7 @@ xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
if ((attr->defaultValue != NULL) && (attr->tree != NULL)) { if ((attr->defaultValue != NULL) && (attr->tree != NULL)) {
xmlEnumerationPtr tree = attr->tree; xmlEnumerationPtr tree = attr->tree;
while (tree != NULL) { while (tree != NULL) {
if (!xmlStrcmp(tree->name, attr->defaultValue)) break; if (xmlStrEqual(tree->name, attr->defaultValue)) break;
tree = tree->next; tree = tree->next;
} }
if (tree == NULL) { if (tree == NULL) {
@ -3074,7 +3074,7 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
next = cur->c2; next = cur->c2;
while (next != NULL) { while (next != NULL) {
if (next->type == XML_ELEMENT_CONTENT_ELEMENT) { if (next->type == XML_ELEMENT_CONTENT_ELEMENT) {
if (!xmlStrcmp(next->name, name)) { if (xmlStrEqual(next->name, name)) {
VERROR(ctxt->userData, VERROR(ctxt->userData,
"Definition of %s has duplicate references of %s\n", "Definition of %s has duplicate references of %s\n",
elem->name, name); elem->name, name);
@ -3084,7 +3084,7 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
} }
if (next->c1 == NULL) break; if (next->c1 == NULL) break;
if (next->c1->type != XML_ELEMENT_CONTENT_ELEMENT) break; if (next->c1->type != XML_ELEMENT_CONTENT_ELEMENT) break;
if (!xmlStrcmp(next->c1->name, name)) { if (xmlStrEqual(next->c1->name, name)) {
VERROR(ctxt->userData, VERROR(ctxt->userData,
"Definition of %s has duplicate references of %s\n", "Definition of %s has duplicate references of %s\n",
elem->name, name); elem->name, name);
@ -3213,7 +3213,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
/* Validity constraint: Fixed Attribute Default */ /* Validity constraint: Fixed Attribute Default */
if (attrDecl->def == XML_ATTRIBUTE_FIXED) { if (attrDecl->def == XML_ATTRIBUTE_FIXED) {
if (xmlStrcmp(value, attrDecl->defaultValue)) { if (!xmlStrEqual(value, attrDecl->defaultValue)) {
VERROR(ctxt->userData, VERROR(ctxt->userData,
"Value for attribute %s on %s is differnt from default \"%s\"\n", "Value for attribute %s on %s is differnt from default \"%s\"\n",
attr->name, elem->name, attrDecl->defaultValue); attr->name, elem->name, attrDecl->defaultValue);
@ -3250,7 +3250,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
/* Second, verify that it's among the list */ /* Second, verify that it's among the list */
while (tree != NULL) { while (tree != NULL) {
if (!xmlStrcmp(tree->name, value)) break; if (xmlStrEqual(tree->name, value)) break;
tree = tree->next; tree = tree->next;
} }
if (tree == NULL) { if (tree == NULL) {
@ -3265,7 +3265,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
if (attrDecl->atype == XML_ATTRIBUTE_ENUMERATION) { if (attrDecl->atype == XML_ATTRIBUTE_ENUMERATION) {
xmlEnumerationPtr tree = attrDecl->tree; xmlEnumerationPtr tree = attrDecl->tree;
while (tree != NULL) { while (tree != NULL) {
if (!xmlStrcmp(tree->name, value)) break; if (xmlStrEqual(tree->name, value)) break;
tree = tree->next; tree = tree->next;
} }
if (tree == NULL) { if (tree == NULL) {
@ -3278,7 +3278,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
/* Fixed Attribute Default */ /* Fixed Attribute Default */
if ((attrDecl->def == XML_ATTRIBUTE_FIXED) && if ((attrDecl->def == XML_ATTRIBUTE_FIXED) &&
(xmlStrcmp(attrDecl->defaultValue, value))) { (!xmlStrEqual(attrDecl->defaultValue, value))) {
VERROR(ctxt->userData, VERROR(ctxt->userData,
"Value for attribute %s on %s must be \"%s\"\n", "Value for attribute %s on %s must be \"%s\"\n",
attr->name, elem->name, attrDecl->defaultValue); attr->name, elem->name, attrDecl->defaultValue);
@ -3352,7 +3352,7 @@ xmlValidateElementTypeExpr(xmlValidCtxtPtr ctxt, xmlNodePtr *child,
return(0); return(0);
case XML_ELEMENT_CONTENT_ELEMENT: case XML_ELEMENT_CONTENT_ELEMENT:
if (*child == NULL) return(0); if (*child == NULL) return(0);
ret = (!xmlStrcmp((*child)->name, cont->name)); ret = (xmlStrEqual((*child)->name, cont->name));
if (ret == 1) { if (ret == 1) {
while ((*child)->next == NULL) { while ((*child)->next == NULL) {
if (((*child)->parent != NULL) && if (((*child)->parent != NULL) &&
@ -3738,11 +3738,11 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
cont = elemDecl->content; cont = elemDecl->content;
while (cont != NULL) { while (cont != NULL) {
if (cont->type == XML_ELEMENT_CONTENT_ELEMENT) { if (cont->type == XML_ELEMENT_CONTENT_ELEMENT) {
if (!xmlStrcmp(cont->name, qname)) break; if (xmlStrEqual(cont->name, qname)) break;
} else if ((cont->type == XML_ELEMENT_CONTENT_OR) && } else if ((cont->type == XML_ELEMENT_CONTENT_OR) &&
(cont->c1 != NULL) && (cont->c1 != NULL) &&
(cont->c1->type == XML_ELEMENT_CONTENT_ELEMENT)){ (cont->c1->type == XML_ELEMENT_CONTENT_ELEMENT)){
if (!xmlStrcmp(cont->c1->name, qname)) break; if (xmlStrEqual(cont->c1->name, qname)) break;
} else if ((cont->type != XML_ELEMENT_CONTENT_OR) || } else if ((cont->type != XML_ELEMENT_CONTENT_OR) ||
(cont->c1 == NULL) || (cont->c1 == NULL) ||
(cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){ (cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){
@ -3758,11 +3758,11 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
cont = elemDecl->content; cont = elemDecl->content;
while (cont != NULL) { while (cont != NULL) {
if (cont->type == XML_ELEMENT_CONTENT_ELEMENT) { if (cont->type == XML_ELEMENT_CONTENT_ELEMENT) {
if (!xmlStrcmp(cont->name, name)) break; if (xmlStrEqual(cont->name, name)) break;
} else if ((cont->type == XML_ELEMENT_CONTENT_OR) && } else if ((cont->type == XML_ELEMENT_CONTENT_OR) &&
(cont->c1 != NULL) && (cont->c1 != NULL) &&
(cont->c1->type == XML_ELEMENT_CONTENT_ELEMENT)) { (cont->c1->type == XML_ELEMENT_CONTENT_ELEMENT)) {
if (!xmlStrcmp(cont->c1->name, name)) break; if (xmlStrEqual(cont->c1->name, name)) break;
} else if ((cont->type != XML_ELEMENT_CONTENT_OR) || } else if ((cont->type != XML_ELEMENT_CONTENT_OR) ||
(cont->c1 == NULL) || (cont->c1 == NULL) ||
(cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)) { (cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)) {
@ -3813,7 +3813,7 @@ child_ok:
attrib = elem->properties; attrib = elem->properties;
while (attrib != NULL) { while (attrib != NULL) {
if (!xmlStrcmp(attrib->name, attr->name)) { if (xmlStrEqual(attrib->name, attr->name)) {
if (attr->prefix != NULL) { if (attr->prefix != NULL) {
xmlNsPtr nameSpace = attrib->ns; xmlNsPtr nameSpace = attrib->ns;
@ -3827,7 +3827,7 @@ child_ok:
if (nameSpace == NULL) { if (nameSpace == NULL) {
if (qualified < 0) if (qualified < 0)
qualified = 0; qualified = 0;
} else if (xmlStrcmp(nameSpace->prefix, attr->prefix)) { } else if (!xmlStrEqual(nameSpace->prefix, attr->prefix)) {
if (qualified < 1) if (qualified < 1)
qualified = 1; qualified = 1;
} else } else
@ -3903,7 +3903,7 @@ xmlValidateRoot(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
/* /*
* Check first the document root against the NQName * Check first the document root against the NQName
*/ */
if (xmlStrcmp(doc->intSubset->name, root->name)) { if (!xmlStrEqual(doc->intSubset->name, root->name)) {
if ((root->ns != NULL) && (root->ns->prefix != NULL)) { if ((root->ns != NULL) && (root->ns->prefix != NULL)) {
xmlChar qname[500]; xmlChar qname[500];
#ifdef HAVE_SNPRINTF #ifdef HAVE_SNPRINTF
@ -3913,11 +3913,11 @@ xmlValidateRoot(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
sprintf((char *) qname, "%s:%s", root->ns->prefix, root->name); sprintf((char *) qname, "%s:%s", root->ns->prefix, root->name);
#endif #endif
qname[sizeof(qname) - 1] = 0; qname[sizeof(qname) - 1] = 0;
if (!xmlStrcmp(doc->intSubset->name, qname)) if (xmlStrEqual(doc->intSubset->name, qname))
goto name_ok; goto name_ok;
} }
if ((!xmlStrcmp(doc->intSubset->name, BAD_CAST "HTML")) && if ((xmlStrEqual(doc->intSubset->name, BAD_CAST "HTML")) &&
(!xmlStrcmp(root->name, BAD_CAST "html"))) (xmlStrEqual(root->name, BAD_CAST "html")))
goto name_ok; goto name_ok;
VERROR(ctxt->userData, VERROR(ctxt->userData,
"Not valid: root and DtD name do not match '%s' and '%s'\n", "Not valid: root and DtD name do not match '%s' and '%s'\n",
@ -4255,12 +4255,12 @@ xmlValidGetPotentialChildren(xmlElementContent *ctree, const xmlChar **list,
switch (ctree->type) { switch (ctree->type) {
case XML_ELEMENT_CONTENT_PCDATA: case XML_ELEMENT_CONTENT_PCDATA:
for (i = 0; i < *len;i++) for (i = 0; i < *len;i++)
if (!xmlStrcmp(BAD_CAST "#PCDATA", list[i])) return(*len); if (xmlStrEqual(BAD_CAST "#PCDATA", list[i])) return(*len);
list[(*len)++] = BAD_CAST "#PCDATA"; list[(*len)++] = BAD_CAST "#PCDATA";
break; break;
case XML_ELEMENT_CONTENT_ELEMENT: case XML_ELEMENT_CONTENT_ELEMENT:
for (i = 0; i < *len;i++) for (i = 0; i < *len;i++)
if (!xmlStrcmp(ctree->name, list[i])) return(*len); if (xmlStrEqual(ctree->name, list[i])) return(*len);
list[(*len)++] = ctree->name; list[(*len)++] = ctree->name;
break; break;
case XML_ELEMENT_CONTENT_SEQ: case XML_ELEMENT_CONTENT_SEQ:
@ -4375,7 +4375,7 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **list,
int j; int j;
for (j = 0; j < nb_valid_elements;j++) for (j = 0; j < nb_valid_elements;j++)
if (!xmlStrcmp(elements[i], list[j])) break; if (xmlStrEqual(elements[i], list[j])) break;
list[nb_valid_elements++] = elements[i]; list[nb_valid_elements++] = elements[i];
if (nb_valid_elements >= max) break; if (nb_valid_elements >= max) break;
} }

10
xlink.c
View File

@ -133,7 +133,7 @@ xlinkIsLink (xmlDocPtr doc, xmlNodePtr node) {
* This is an HTML document. * This is an HTML document.
*/ */
} else if ((node->ns != NULL) && } else if ((node->ns != NULL) &&
(!xmlStrcmp(node->ns->href, XHTML_NAMESPACE))) { (xmlStrEqual(node->ns->href, XHTML_NAMESPACE))) {
/* /*
* !!!! We really need an IS_XHTML_ELEMENT function from HTMLtree.h @@@ * !!!! We really need an IS_XHTML_ELEMENT function from HTMLtree.h @@@
*/ */
@ -150,16 +150,16 @@ xlinkIsLink (xmlDocPtr doc, xmlNodePtr node) {
*/ */
type = xmlGetNsProp(node, BAD_CAST"type", XLINK_NAMESPACE); type = xmlGetNsProp(node, BAD_CAST"type", XLINK_NAMESPACE);
if (type != NULL) { if (type != NULL) {
if (xmlStrcmp(type, BAD_CAST "simple")) { if (!xmlStrEqual(type, BAD_CAST "simple")) {
ret = XLINK_TYPE_SIMPLE; ret = XLINK_TYPE_SIMPLE;
} if (xmlStrcmp(type, BAD_CAST "extended")) { } if (!xmlStrEqual(type, BAD_CAST "extended")) {
role = xmlGetNsProp(node, BAD_CAST "role", XLINK_NAMESPACE); role = xmlGetNsProp(node, BAD_CAST "role", XLINK_NAMESPACE);
if (role != NULL) { if (role != NULL) {
xmlNsPtr xlink; xmlNsPtr xlink;
xlink = xmlSearchNs(doc, node, XLINK_NAMESPACE); xlink = xmlSearchNs(doc, node, XLINK_NAMESPACE);
if (xlink == NULL) { if (xlink == NULL) {
/* Humm, fallback method */ /* Humm, fallback method */
if (!xmlStrcmp(role, BAD_CAST"xlink:external-linkset")) if (xmlStrEqual(role, BAD_CAST"xlink:external-linkset"))
ret = XLINK_TYPE_EXTENDED_SET; ret = XLINK_TYPE_EXTENDED_SET;
} else { } else {
xmlChar buf[200]; xmlChar buf[200];
@ -171,7 +171,7 @@ xlinkIsLink (xmlDocPtr doc, xmlNodePtr node) {
(char *) xlink->prefix); (char *) xlink->prefix);
#endif #endif
buf[sizeof(buf) - 1] = 0; buf[sizeof(buf) - 1] = 0;
if (!xmlStrcmp(role, buf)) if (xmlStrEqual(role, buf))
ret = XLINK_TYPE_EXTENDED_SET; ret = XLINK_TYPE_EXTENDED_SET;
} }

102
xpath.c
View File

@ -996,7 +996,7 @@ xmlXPathEqualNodeSetString(xmlXPathObjectPtr arg, const xmlChar *str) {
ns = arg->nodesetval; ns = arg->nodesetval;
for (i = 0;i < ns->nodeNr;i++) { for (i = 0;i < ns->nodeNr;i++) {
str2 = xmlNodeGetContent(ns->nodeTab[i]); str2 = xmlNodeGetContent(ns->nodeTab[i]);
if ((str2 != NULL) && (!xmlStrcmp(str, str2))) { if ((str2 != NULL) && (xmlStrEqual(str, str2))) {
xmlFree(str2); xmlFree(str2);
return(1); return(1);
} }
@ -1215,7 +1215,7 @@ xmlXPathEqualValues(xmlXPathParserContextPtr ctxt) {
ret = (arg2->boolval == ret); ret = (arg2->boolval == ret);
break; break;
case XPATH_STRING: case XPATH_STRING:
ret = !xmlStrcmp(arg1->stringval, arg2->stringval); ret = xmlStrEqual(arg1->stringval, arg2->stringval);
break; break;
case XPATH_NUMBER: case XPATH_NUMBER:
valuePush(ctxt, arg1); valuePush(ctxt, arg1);
@ -2099,7 +2099,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, int axis,
case NODE_TEST_PI: case NODE_TEST_PI:
if (cur->type == XML_PI_NODE) { if (cur->type == XML_PI_NODE) {
if ((name != NULL) && if ((name != NULL) &&
(xmlStrcmp(name, cur->name))) (!xmlStrEqual(name, cur->name)))
break; break;
#ifdef DEBUG_STEP #ifdef DEBUG_STEP
n++; n++;
@ -2124,10 +2124,10 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, int axis,
case NODE_TEST_NAME: case NODE_TEST_NAME:
switch (cur->type) { switch (cur->type) {
case XML_ELEMENT_NODE: case XML_ELEMENT_NODE:
if (!xmlStrcmp(name, cur->name) && if (xmlStrEqual(name, cur->name) &&
(((prefix == NULL) || (((prefix == NULL) ||
((cur->ns != NULL) && ((cur->ns != NULL) &&
(!xmlStrcmp(prefix, cur->ns->href)))))) { (xmlStrEqual(prefix, cur->ns->href)))))) {
#ifdef DEBUG_STEP #ifdef DEBUG_STEP
n++; n++;
#endif #endif
@ -2136,7 +2136,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, int axis,
break; break;
case XML_ATTRIBUTE_NODE: { case XML_ATTRIBUTE_NODE: {
xmlAttrPtr attr = (xmlAttrPtr) cur; xmlAttrPtr attr = (xmlAttrPtr) cur;
if (!xmlStrcmp(name, attr->name)) { if (xmlStrEqual(name, attr->name)) {
#ifdef DEBUG_STEP #ifdef DEBUG_STEP
n++; n++;
#endif #endif
@ -3451,79 +3451,79 @@ xmlXPathFunction
xmlXPathIsFunction(xmlXPathParserContextPtr ctxt, const xmlChar *name) { xmlXPathIsFunction(xmlXPathParserContextPtr ctxt, const xmlChar *name) {
switch (name[0]) { switch (name[0]) {
case 'b': case 'b':
if (!xmlStrcmp(name, BAD_CAST "boolean")) if (xmlStrEqual(name, BAD_CAST "boolean"))
return(xmlXPathBooleanFunction); return(xmlXPathBooleanFunction);
break; break;
case 'c': case 'c':
if (!xmlStrcmp(name, BAD_CAST "ceiling")) if (xmlStrEqual(name, BAD_CAST "ceiling"))
return(xmlXPathCeilingFunction); return(xmlXPathCeilingFunction);
if (!xmlStrcmp(name, BAD_CAST "count")) if (xmlStrEqual(name, BAD_CAST "count"))
return(xmlXPathCountFunction); return(xmlXPathCountFunction);
if (!xmlStrcmp(name, BAD_CAST "concat")) if (xmlStrEqual(name, BAD_CAST "concat"))
return(xmlXPathConcatFunction); return(xmlXPathConcatFunction);
if (!xmlStrcmp(name, BAD_CAST "contains")) if (xmlStrEqual(name, BAD_CAST "contains"))
return(xmlXPathContainsFunction); return(xmlXPathContainsFunction);
break; break;
case 'i': case 'i':
if (!xmlStrcmp(name, BAD_CAST "id")) if (xmlStrEqual(name, BAD_CAST "id"))
return(xmlXPathIdFunction); return(xmlXPathIdFunction);
break; break;
case 'f': case 'f':
if (!xmlStrcmp(name, BAD_CAST "false")) if (xmlStrEqual(name, BAD_CAST "false"))
return(xmlXPathFalseFunction); return(xmlXPathFalseFunction);
if (!xmlStrcmp(name, BAD_CAST "floor")) if (xmlStrEqual(name, BAD_CAST "floor"))
return(xmlXPathFloorFunction); return(xmlXPathFloorFunction);
break; break;
case 'l': case 'l':
if (!xmlStrcmp(name, BAD_CAST "last")) if (xmlStrEqual(name, BAD_CAST "last"))
return(xmlXPathLastFunction); return(xmlXPathLastFunction);
if (!xmlStrcmp(name, BAD_CAST "lang")) if (xmlStrEqual(name, BAD_CAST "lang"))
return(xmlXPathLangFunction); return(xmlXPathLangFunction);
if (!xmlStrcmp(name, BAD_CAST "local-part")) if (xmlStrEqual(name, BAD_CAST "local-part"))
return(xmlXPathLocalPartFunction); return(xmlXPathLocalPartFunction);
break; break;
case 'n': case 'n':
if (!xmlStrcmp(name, BAD_CAST "not")) if (xmlStrEqual(name, BAD_CAST "not"))
return(xmlXPathNotFunction); return(xmlXPathNotFunction);
if (!xmlStrcmp(name, BAD_CAST "name")) if (xmlStrEqual(name, BAD_CAST "name"))
return(xmlXPathNameFunction); return(xmlXPathNameFunction);
if (!xmlStrcmp(name, BAD_CAST "namespace")) if (xmlStrEqual(name, BAD_CAST "namespace"))
return(xmlXPathNamespaceFunction); return(xmlXPathNamespaceFunction);
if (!xmlStrcmp(name, BAD_CAST "normalize-space")) if (xmlStrEqual(name, BAD_CAST "normalize-space"))
return(xmlXPathNormalizeFunction); return(xmlXPathNormalizeFunction);
if (!xmlStrcmp(name, BAD_CAST "normalize")) if (xmlStrEqual(name, BAD_CAST "normalize"))
return(xmlXPathNormalizeFunction); return(xmlXPathNormalizeFunction);
if (!xmlStrcmp(name, BAD_CAST "number")) if (xmlStrEqual(name, BAD_CAST "number"))
return(xmlXPathNumberFunction); return(xmlXPathNumberFunction);
break; break;
case 'p': case 'p':
if (!xmlStrcmp(name, BAD_CAST "position")) if (xmlStrEqual(name, BAD_CAST "position"))
return(xmlXPathPositionFunction); return(xmlXPathPositionFunction);
break; break;
case 'r': case 'r':
if (!xmlStrcmp(name, BAD_CAST "round")) if (xmlStrEqual(name, BAD_CAST "round"))
return(xmlXPathRoundFunction); return(xmlXPathRoundFunction);
break; break;
case 's': case 's':
if (!xmlStrcmp(name, BAD_CAST "string")) if (xmlStrEqual(name, BAD_CAST "string"))
return(xmlXPathStringFunction); return(xmlXPathStringFunction);
if (!xmlStrcmp(name, BAD_CAST "string-length")) if (xmlStrEqual(name, BAD_CAST "string-length"))
return(xmlXPathStringLengthFunction); return(xmlXPathStringLengthFunction);
if (!xmlStrcmp(name, BAD_CAST "starts-with")) if (xmlStrEqual(name, BAD_CAST "starts-with"))
return(xmlXPathStartsWithFunction); return(xmlXPathStartsWithFunction);
if (!xmlStrcmp(name, BAD_CAST "substring")) if (xmlStrEqual(name, BAD_CAST "substring"))
return(xmlXPathSubstringFunction); return(xmlXPathSubstringFunction);
if (!xmlStrcmp(name, BAD_CAST "substring-before")) if (xmlStrEqual(name, BAD_CAST "substring-before"))
return(xmlXPathSubstringBeforeFunction); return(xmlXPathSubstringBeforeFunction);
if (!xmlStrcmp(name, BAD_CAST "substring-after")) if (xmlStrEqual(name, BAD_CAST "substring-after"))
return(xmlXPathSubstringAfterFunction); return(xmlXPathSubstringAfterFunction);
if (!xmlStrcmp(name, BAD_CAST "sum")) if (xmlStrEqual(name, BAD_CAST "sum"))
return(xmlXPathSumFunction); return(xmlXPathSumFunction);
break; break;
case 't': case 't':
if (!xmlStrcmp(name, BAD_CAST "true")) if (xmlStrEqual(name, BAD_CAST "true"))
return(xmlXPathTrueFunction); return(xmlXPathTrueFunction);
if (!xmlStrcmp(name, BAD_CAST "translate")) if (xmlStrEqual(name, BAD_CAST "translate"))
return(xmlXPathTranslateFunction); return(xmlXPathTranslateFunction);
break; break;
} }
@ -3560,43 +3560,43 @@ int
xmlXPathGetNameType(xmlXPathParserContextPtr ctxt, const xmlChar *name) { xmlXPathGetNameType(xmlXPathParserContextPtr ctxt, const xmlChar *name) {
switch (name[0]) { switch (name[0]) {
case 'a': case 'a':
if (!xmlStrcmp(name, BAD_CAST "ancestor")) return(AXIS_ANCESTOR); if (xmlStrEqual(name, BAD_CAST "ancestor")) return(AXIS_ANCESTOR);
if (!xmlStrcmp(name, BAD_CAST "ancestor-or-self")) if (xmlStrEqual(name, BAD_CAST "ancestor-or-self"))
return(AXIS_ANCESTOR_OR_SELF); return(AXIS_ANCESTOR_OR_SELF);
if (!xmlStrcmp(name, BAD_CAST "attribute")) return(AXIS_ATTRIBUTE); if (xmlStrEqual(name, BAD_CAST "attribute")) return(AXIS_ATTRIBUTE);
break; break;
case 'c': case 'c':
if (!xmlStrcmp(name, BAD_CAST "child")) return(AXIS_CHILD); if (xmlStrEqual(name, BAD_CAST "child")) return(AXIS_CHILD);
if (!xmlStrcmp(name, BAD_CAST "comment")) return(NODE_TYPE_COMMENT); if (xmlStrEqual(name, BAD_CAST "comment")) return(NODE_TYPE_COMMENT);
break; break;
case 'd': case 'd':
if (!xmlStrcmp(name, BAD_CAST "descendant")) if (xmlStrEqual(name, BAD_CAST "descendant"))
return(AXIS_DESCENDANT); return(AXIS_DESCENDANT);
if (!xmlStrcmp(name, BAD_CAST "descendant-or-self")) if (xmlStrEqual(name, BAD_CAST "descendant-or-self"))
return(AXIS_DESCENDANT_OR_SELF); return(AXIS_DESCENDANT_OR_SELF);
break; break;
case 'f': case 'f':
if (!xmlStrcmp(name, BAD_CAST "following")) return(AXIS_FOLLOWING); if (xmlStrEqual(name, BAD_CAST "following")) return(AXIS_FOLLOWING);
if (!xmlStrcmp(name, BAD_CAST "following-sibling")) if (xmlStrEqual(name, BAD_CAST "following-sibling"))
return(AXIS_FOLLOWING_SIBLING); return(AXIS_FOLLOWING_SIBLING);
break; break;
case 'n': case 'n':
if (!xmlStrcmp(name, BAD_CAST "namespace")) return(AXIS_NAMESPACE); if (xmlStrEqual(name, BAD_CAST "namespace")) return(AXIS_NAMESPACE);
if (!xmlStrcmp(name, BAD_CAST "node")) return(NODE_TYPE_NODE); if (xmlStrEqual(name, BAD_CAST "node")) return(NODE_TYPE_NODE);
break; break;
case 'p': case 'p':
if (!xmlStrcmp(name, BAD_CAST "parent")) return(AXIS_PARENT); if (xmlStrEqual(name, BAD_CAST "parent")) return(AXIS_PARENT);
if (!xmlStrcmp(name, BAD_CAST "preceding")) return(AXIS_PRECEDING); if (xmlStrEqual(name, BAD_CAST "preceding")) return(AXIS_PRECEDING);
if (!xmlStrcmp(name, BAD_CAST "preceding-sibling")) if (xmlStrEqual(name, BAD_CAST "preceding-sibling"))
return(AXIS_PRECEDING_SIBLING); return(AXIS_PRECEDING_SIBLING);
if (!xmlStrcmp(name, BAD_CAST "processing-instruction")) if (xmlStrEqual(name, BAD_CAST "processing-instruction"))
return(NODE_TYPE_PI); return(NODE_TYPE_PI);
break; break;
case 's': case 's':
if (!xmlStrcmp(name, BAD_CAST "self")) return(AXIS_SELF); if (xmlStrEqual(name, BAD_CAST "self")) return(AXIS_SELF);
break; break;
case 't': case 't':
if (!xmlStrcmp(name, BAD_CAST "text")) return(NODE_TYPE_TEXT); if (xmlStrEqual(name, BAD_CAST "text")) return(NODE_TYPE_TEXT);
break; break;
} }
if (xmlXPathIsFunction(ctxt, name)) return(IS_FUNCTION); if (xmlXPathIsFunction(ctxt, name)) return(IS_FUNCTION);