1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-02-04 01:47:02 +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>
* HTMLparser.c: fixed htmlStartCloseIndexinitialized init

View File

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

View File

@ -61,11 +61,11 @@ htmlGetMetaEncoding(htmlDocPtr doc) {
*/
while (cur != NULL) {
if (cur->name != NULL) {
if (!xmlStrcmp(cur->name, BAD_CAST"html"))
if (xmlStrEqual(cur->name, BAD_CAST"html"))
break;
if (!xmlStrcmp(cur->name, BAD_CAST"head"))
if (xmlStrEqual(cur->name, BAD_CAST"head"))
goto found_head;
if (!xmlStrcmp(cur->name, BAD_CAST"meta"))
if (xmlStrEqual(cur->name, BAD_CAST"meta"))
goto found_meta;
}
cur = cur->next;
@ -79,9 +79,9 @@ htmlGetMetaEncoding(htmlDocPtr doc) {
*/
while (cur != NULL) {
if (cur->name != NULL) {
if (!xmlStrcmp(cur->name, BAD_CAST"head"))
if (xmlStrEqual(cur->name, BAD_CAST"head"))
break;
if (!xmlStrcmp(cur->name, BAD_CAST"meta"))
if (xmlStrEqual(cur->name, BAD_CAST"meta"))
goto found_meta;
}
cur = cur->next;
@ -97,7 +97,7 @@ found_head:
found_meta:
while (cur != NULL) {
if (cur->name != NULL) {
if (!xmlStrcmp(cur->name, BAD_CAST"meta")) {
if (xmlStrEqual(cur->name, BAD_CAST"meta")) {
xmlAttrPtr attr = cur->properties;
int http;
const xmlChar *value;
@ -191,9 +191,9 @@ htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) {
*/
while (cur != NULL) {
if (cur->name != NULL) {
if (!xmlStrcmp(cur->name, BAD_CAST"html"))
if (xmlStrEqual(cur->name, BAD_CAST"html"))
break;
if (!xmlStrcmp(cur->name, BAD_CAST"body")) {
if (xmlStrEqual(cur->name, BAD_CAST"body")) {
if (encoding == NULL)
return(0);
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);
return(0);
}
if (!xmlStrcmp(cur->name, BAD_CAST"head"))
if (xmlStrEqual(cur->name, BAD_CAST"head"))
goto found_head;
if (!xmlStrcmp(cur->name, BAD_CAST"meta"))
if (xmlStrEqual(cur->name, BAD_CAST"meta"))
goto found_meta;
}
cur = cur->next;
@ -221,9 +221,9 @@ htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) {
*/
while (cur != NULL) {
if (cur->name != NULL) {
if (!xmlStrcmp(cur->name, BAD_CAST"head"))
if (xmlStrEqual(cur->name, BAD_CAST"head"))
break;
if (!xmlStrcmp(cur->name, BAD_CAST"body")) {
if (xmlStrEqual(cur->name, BAD_CAST"body")) {
if (encoding == NULL)
return(0);
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);
return(0);
}
if (!xmlStrcmp(cur->name, BAD_CAST"meta"))
if (xmlStrEqual(cur->name, BAD_CAST"meta"))
goto found_meta;
}
cur = cur->next;
@ -272,7 +272,7 @@ found_meta:
*/
while (cur != NULL) {
if (cur->name != NULL) {
if (!xmlStrcmp(cur->name, BAD_CAST"meta")) {
if (xmlStrEqual(cur->name, BAD_CAST"meta")) {
xmlAttrPtr attr = cur->properties;
int http;
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",
cur->name, namespace);
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))
ctxt->sax->error(ctxt,
"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:
=====
- cleanup the mess with URI references when composing entities.
- performances: there is still improvements needed when parsing Docbook DTD
a single function to optimize/avoid.
- Moving all deprecated functions to a different module, allow to compile
it out.
- DOM needs
int xmlPruneProp(xmlNodePtr node, xmlAtttrPtr attr);
- 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)
2.9 Standalone Document Declaration
- 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
function to open a new element with given attributes, write character
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:
=====

View File

@ -6,7 +6,7 @@ AC_CANONICAL_HOST
LIBXML_MAJOR_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_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;
while (tmp != NULL) {
if (!xmlStrcmp(cur->name, tmp->name))
if (xmlStrEqual(cur->name, tmp->name))
occur++;
tmp = tmp->prev;
}
if (occur == 0) {
tmp = cur->next;
while (tmp != NULL) {
if (!xmlStrcmp(cur->name, tmp->name))
if (xmlStrEqual(cur->name, tmp->name))
occur++;
tmp = tmp->next;
}

View File

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

View File

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

View File

@ -1020,6 +1020,28 @@ xmlStrcmp(const xmlChar *str1, const xmlChar *str2) {
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:
* @str1: the first xmlChar *
@ -2649,7 +2671,7 @@ xmlParsePITarget(xmlParserCtxtPtr ctxt) {
}
for (i = 0;;i++) {
if (xmlW3CPIs[i] == NULL) break;
if (!xmlStrcmp(name, (const xmlChar *)xmlW3CPIs[i]))
if (xmlStrEqual(name, (const xmlChar *)xmlW3CPIs[i]))
return(name);
}
if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) {
@ -4696,7 +4718,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
*/
if ((value != NULL) &&
(value[1] == 0) && (value[0] == '<') &&
(!xmlStrcmp(ent->name, BAD_CAST "lt"))) {
(xmlStrEqual(ent->name, BAD_CAST "lt"))) {
/*
* DONE: get definite answer on this !!!
* 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) &&
(ent != NULL) &&
(xmlStrcmp(ent->name, BAD_CAST "lt")) &&
(!xmlStrEqual(ent->name, BAD_CAST "lt")) &&
(ent->content != NULL) &&
(xmlStrchr(ent->content, '<'))) {
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) &&
(ent != NULL) &&
(xmlStrcmp(ent->name, BAD_CAST "lt")) &&
(!xmlStrEqual(ent->name, BAD_CAST "lt")) &&
(ent->content != NULL) &&
(xmlStrchr(ent->content, '<'))) {
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
* 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 ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
ctxt->sax->warning(ctxt->userData,
@ -5721,10 +5743,10 @@ xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlChar **value) {
/*
* Check that xml:space conforms to the specification
*/
if (!xmlStrcmp(name, BAD_CAST "xml:space")) {
if (!xmlStrcmp(val, BAD_CAST "default"))
if (xmlStrEqual(name, BAD_CAST "xml:space")) {
if (xmlStrEqual(val, BAD_CAST "default"))
*(ctxt->space) = 0;
else if (!xmlStrcmp(val, BAD_CAST "preserve"))
else if (xmlStrEqual(val, BAD_CAST "preserve"))
*(ctxt->space) = 1;
else {
ctxt->errNo = XML_ERR_ATTRIBUTE_WITHOUT_VALUE;
@ -5815,7 +5837,7 @@ xmlParseStartTag(xmlParserCtxtPtr ctxt) {
* start-tag or empty-element tag.
*/
for (i = 0; i < nbatts;i += 2) {
if (!xmlStrcmp(atts[i], attname)) {
if (xmlStrEqual(atts[i], attname)) {
ctxt->errNo = XML_ERR_ATTRIBUTE_REDEFINED;
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData,
@ -5952,7 +5974,7 @@ xmlParseEndTag(xmlParserCtxtPtr ctxt) {
*
*/
if ((name == NULL) || (ctxt->name == NULL) ||
(xmlStrcmp(name, ctxt->name))) {
(!xmlStrEqual(name, ctxt->name))) {
ctxt->errNo = XML_ERR_TAG_NAME_MISMATCH;
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) {
if ((name != NULL) && (ctxt->name != NULL)) {

View File

@ -348,6 +348,8 @@ int xmlStrcasecmp (const xmlChar *str1,
int xmlStrncasecmp (const xmlChar *str1,
const xmlChar *str2,
int len);
int xmlStrEqual (const xmlChar *str1,
const xmlChar *str2);
int xmlStrlen (const xmlChar *str);
xmlChar * xmlStrcat (xmlChar *cur,
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;
if (((prev->prefix == NULL) && (cur->prefix == NULL)) ||
(!xmlStrcmp(prev->prefix, cur->prefix))) {
(xmlStrEqual(prev->prefix, cur->prefix))) {
xmlFreeNs(cur);
return(NULL);
}
while (prev->next != NULL) {
prev = prev->next;
if (((prev->prefix == NULL) && (cur->prefix == NULL)) ||
(!xmlStrcmp(prev->prefix, cur->prefix))) {
(xmlStrEqual(prev->prefix, cur->prefix))) {
xmlFreeNs(cur);
return(NULL);
}
@ -2687,11 +2687,11 @@ xmlNodeGetSpacePreserve(xmlNodePtr cur) {
while (cur != NULL) {
space = xmlGetProp(cur, BAD_CAST "xml:space");
if (space != NULL) {
if (!xmlStrcmp(space, BAD_CAST "preserve")) {
if (xmlStrEqual(space, BAD_CAST "preserve")) {
xmlFree(space);
return(1);
}
if (!xmlStrcmp(space, BAD_CAST "default")) {
if (xmlStrEqual(space, BAD_CAST "default")) {
xmlFree(space);
return(0);
}
@ -3194,7 +3194,7 @@ xmlGetNsList(xmlDocPtr doc, xmlNodePtr node) {
}
for (i = 0;i < nbns;i++) {
if ((cur->prefix == ret[i]->prefix) ||
(!xmlStrcmp(cur->prefix, ret[i]->prefix))) break;
(xmlStrEqual(cur->prefix, ret[i]->prefix))) break;
}
if (i >= nbns) {
if (nbns >= maxns) {
@ -3251,7 +3251,7 @@ xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) {
return(cur);
if ((cur->prefix != NULL) && (nameSpace != NULL) &&
(cur->href != NULL) &&
(!xmlStrcmp(cur->prefix, nameSpace)))
(xmlStrEqual(cur->prefix, nameSpace)))
return(cur);
cur = cur->next;
}
@ -3281,7 +3281,7 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar *href) {
cur = node->nsDef;
while (cur != 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
*/
@ -3294,7 +3294,7 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar *href) {
if ((tst->prefix == NULL) && (cur->prefix == NULL))
goto shadowed;
if ((tst->prefix != NULL) && (cur->prefix != NULL) &&
(!xmlStrcmp(tst->prefix, cur->prefix)))
(xmlStrEqual(tst->prefix, cur->prefix)))
goto shadowed;
tst = tst->next;
}
@ -3576,7 +3576,7 @@ xmlHasProp(xmlNodePtr node, const xmlChar *name) {
*/
prop = node->properties;
while (prop != NULL) {
if (!xmlStrcmp(prop->name, name)) {
if (xmlStrEqual(prop->name, name)) {
return(prop);
}
prop = prop->next;
@ -3625,7 +3625,7 @@ xmlGetProp(xmlNodePtr node, const xmlChar *name) {
*/
prop = node->properties;
while (prop != NULL) {
if (!xmlStrcmp(prop->name, name)) {
if (xmlStrEqual(prop->name, name)) {
xmlChar *ret;
ret = xmlNodeListGetString(node->doc, prop->children, 1);
@ -3685,10 +3685,10 @@ xmlGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *namespace) {
* or
* 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) &&
(!xmlStrcmp(node->ns->href, namespace))) ||
((prop->ns != NULL) && (!xmlStrcmp(prop->ns->href, namespace))))) {
(xmlStrEqual(node->ns->href, namespace))) ||
((prop->ns != NULL) && (xmlStrEqual(prop->ns->href, namespace))))) {
xmlChar *ret;
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
*/
ns = xmlSearchNs(doc, node, attrDecl->prefix);
if ((ns != NULL) && (!xmlStrcmp(ns->href, namespace)))
if ((ns != NULL) && (xmlStrEqual(ns->href, namespace)))
return(xmlStrdup(attrDecl->defaultValue));
}
}
@ -3738,7 +3738,7 @@ xmlSetProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) {
xmlAttrPtr prop = node->properties;
while (prop != NULL) {
if (!xmlStrcmp(prop->name, name)) {
if (xmlStrEqual(prop->name, name)) {
if (prop->children != NULL)
xmlFreeNodeList(prop->children);
prop->children = NULL;

106
valid.c
View File

@ -567,8 +567,8 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name,
cur = table->table[i];
if ((ns != NULL) && (cur->prefix == NULL)) continue;
if ((ns == NULL) && (cur->prefix != NULL)) continue;
if ((!xmlStrcmp(cur->name, name)) &&
((ns == NULL) || (!xmlStrcmp(cur->prefix, ns)))) {
if ((xmlStrEqual(cur->name, name)) &&
((ns == NULL) || (xmlStrEqual(cur->prefix, ns)))) {
/*
* The element is already defined in this Dtd.
*/
@ -927,7 +927,7 @@ xmlScanAttributeDecl(xmlDtdPtr dtd, const xmlChar *elem) {
return(NULL);
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;
ret = table->table[i];
}
@ -1080,8 +1080,8 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem,
cur = cur->nexth;
continue;
}
if ((!xmlStrcmp(cur->name, name)) &&
((ns == NULL) || (!xmlStrcmp(cur->prefix, ns)))) {
if ((xmlStrEqual(cur->name, name)) &&
((ns == NULL) || (xmlStrEqual(cur->prefix, ns)))) {
/*
* The attribute is already defined in this Dtd.
*/
@ -1101,9 +1101,9 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem,
cur = table->table[i];
if ((ns != NULL) && (cur->prefix == NULL)) continue;
if ((ns == NULL) && (cur->prefix != NULL)) continue;
if ((!xmlStrcmp(cur->name, name)) &&
(!xmlStrcmp(cur->elem, elem)) &&
((ns == NULL) || (!xmlStrcmp(cur->prefix, ns)))) {
if ((xmlStrEqual(cur->name, name)) &&
(xmlStrEqual(cur->elem, elem)) &&
((ns == NULL) || (xmlStrEqual(cur->prefix, ns)))) {
/*
* 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++) {
cur = table->table[i];
if (!xmlStrcmp(cur->name, name)) {
if (xmlStrEqual(cur->name, name)) {
/*
* 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++) {
cur = table->table[i];
if (!xmlStrcmp(cur->value, value)) {
if (xmlStrEqual(cur->value, value)) {
/*
* 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[2] == 0)) return(1);
} else if (doc->type == XML_HTML_DOCUMENT_NODE) {
if ((!xmlStrcmp(BAD_CAST "id", attr->name)) ||
(!xmlStrcmp(BAD_CAST "name", attr->name)))
if ((xmlStrEqual(BAD_CAST "id", attr->name)) ||
(xmlStrEqual(BAD_CAST "name", attr->name)))
return(1);
return(0);
} else {
@ -1916,7 +1916,7 @@ xmlGetID(xmlDocPtr doc, const xmlChar *ID) {
*/
for (i = 0;i < table->nb_ids;i++) {
cur = table->table[i];
if (!xmlStrcmp(cur->value, ID)) {
if (xmlStrEqual(cur->value, ID)) {
return(cur->attr);
}
}
@ -2177,7 +2177,7 @@ xmlGetRef(xmlDocPtr doc, const xmlChar *Ref) {
*/
for (i = 0;i < table->nb_refs;i++) {
cur = table->table[i];
if (!xmlStrcmp(cur->value, Ref)) {
if (xmlStrEqual(cur->value, Ref)) {
return(cur->attr);
}
}
@ -2213,12 +2213,12 @@ xmlGetDtdElementDesc(xmlDtdPtr dtd, const xmlChar *name) {
if ((table->last >= 0) && (table->last < table->nb_elements)) {
cur = table->table[table->last];
if (!xmlStrcmp(cur->name, name))
if (xmlStrEqual(cur->name, name))
return(cur);
}
for (i = 0;i < table->nb_elements;i++) {
cur = table->table[i];
if (!xmlStrcmp(cur->name, name)) {
if (xmlStrEqual(cur->name, name)) {
table->last = i;
return(cur);
}
@ -2232,10 +2232,10 @@ xmlGetDtdElementDesc(xmlDtdPtr dtd, const xmlChar *name) {
for (i = 0;i < table->nb_elements;i++) {
cur = table->table[i];
if ((!xmlStrcmp(cur->name, uqname)) &&
if ((xmlStrEqual(cur->name, uqname)) &&
((prefix == cur->prefix) ||
((prefix != NULL) && (cur->prefix != NULL) &&
(!xmlStrcmp(cur->prefix, prefix))))) {
(xmlStrEqual(cur->prefix, prefix))))) {
if (prefix != NULL) xmlFree(prefix);
if (uqname != NULL) xmlFree(uqname);
return(cur);
@ -2270,10 +2270,10 @@ xmlGetDtdQElementDesc(xmlDtdPtr dtd, const xmlChar *name,
for (i = 0;i < table->nb_elements;i++) {
cur = table->table[i];
if (!xmlStrcmp(cur->name, name) &&
if (xmlStrEqual(cur->name, name) &&
((prefix == cur->prefix) ||
((prefix != NULL) && (cur->prefix != NULL) &&
(!xmlStrcmp(cur->prefix, prefix)))))
(xmlStrEqual(cur->prefix, prefix)))))
return(cur);
}
return(NULL);
@ -2310,10 +2310,10 @@ xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name) {
if (etable != NULL) {
for (i = 0;i < etable->nb_elements;i++) {
ecur = etable->table[i];
if (!xmlStrcmp(ecur->name, elem)) {
if (xmlStrEqual(ecur->name, elem)) {
cur = ecur->attributes;
while (cur != NULL) {
if (!xmlStrcmp(cur->name, name))
if (xmlStrEqual(cur->name, name))
return(cur);
cur = cur->nexth;
}
@ -2331,8 +2331,8 @@ xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name) {
return(NULL);
for (i = 0;i < table->nb_attributes;i++) {
cur = table->table[i];
if ((!xmlStrcmp(cur->name, name)) &&
(!xmlStrcmp(cur->elem, elem)))
if ((xmlStrEqual(cur->name, name)) &&
(xmlStrEqual(cur->elem, elem)))
return(cur);
}
@ -2344,11 +2344,11 @@ xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name) {
for (i = 0;i < table->nb_attributes;i++) {
cur = table->table[i];
if ((!xmlStrcmp(cur->name, uqname)) &&
(!xmlStrcmp(cur->elem, elem)) &&
if ((xmlStrEqual(cur->name, uqname)) &&
(xmlStrEqual(cur->elem, elem)) &&
((prefix == cur->prefix) ||
((prefix != NULL) && (cur->prefix != NULL) &&
(!xmlStrcmp(cur->prefix, prefix))))) {
(xmlStrEqual(cur->prefix, prefix))))) {
if (prefix != NULL) xmlFree(prefix);
if (uqname != NULL) xmlFree(uqname);
return(cur);
@ -2385,11 +2385,11 @@ xmlGetDtdQAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name,
for (i = 0;i < table->nb_attributes;i++) {
cur = table->table[i];
if ((!xmlStrcmp(cur->name, name)) &&
(!xmlStrcmp(cur->elem, elem)) &&
if ((xmlStrEqual(cur->name, name)) &&
(xmlStrEqual(cur->elem, elem)) &&
((prefix == cur->prefix) ||
((prefix != NULL) && (cur->prefix != NULL) &&
(!xmlStrcmp(cur->prefix, prefix)))))
(xmlStrEqual(cur->prefix, prefix)))))
return(cur);
}
return(NULL);
@ -2417,7 +2417,7 @@ xmlGetDtdNotationDesc(xmlDtdPtr dtd, const xmlChar *name) {
for (i = 0;i < table->nb_notations;i++) {
cur = table->table[i];
if (!xmlStrcmp(cur->name, name))
if (xmlStrEqual(cur->name, name))
return(cur);
}
return(NULL);
@ -2988,7 +2988,7 @@ xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
if (table != NULL) {
for (i = 0;i < table->nb_attributes;i++) {
if ((table->table[i]->atype == XML_ATTRIBUTE_ID) &&
(!xmlStrcmp(table->table[i]->elem, attr->elem))) {
(xmlStrEqual(table->table[i]->elem, attr->elem))) {
nbId++;
}
}
@ -3020,7 +3020,7 @@ xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
if ((attr->defaultValue != NULL) && (attr->tree != NULL)) {
xmlEnumerationPtr tree = attr->tree;
while (tree != NULL) {
if (!xmlStrcmp(tree->name, attr->defaultValue)) break;
if (xmlStrEqual(tree->name, attr->defaultValue)) break;
tree = tree->next;
}
if (tree == NULL) {
@ -3074,7 +3074,7 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
next = cur->c2;
while (next != NULL) {
if (next->type == XML_ELEMENT_CONTENT_ELEMENT) {
if (!xmlStrcmp(next->name, name)) {
if (xmlStrEqual(next->name, name)) {
VERROR(ctxt->userData,
"Definition of %s has duplicate references of %s\n",
elem->name, name);
@ -3084,7 +3084,7 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
}
if (next->c1 == NULL) 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,
"Definition of %s has duplicate references of %s\n",
elem->name, name);
@ -3213,7 +3213,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
/* Validity constraint: Fixed Attribute Default */
if (attrDecl->def == XML_ATTRIBUTE_FIXED) {
if (xmlStrcmp(value, attrDecl->defaultValue)) {
if (!xmlStrEqual(value, attrDecl->defaultValue)) {
VERROR(ctxt->userData,
"Value for attribute %s on %s is differnt from default \"%s\"\n",
attr->name, elem->name, attrDecl->defaultValue);
@ -3250,7 +3250,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
/* Second, verify that it's among the list */
while (tree != NULL) {
if (!xmlStrcmp(tree->name, value)) break;
if (xmlStrEqual(tree->name, value)) break;
tree = tree->next;
}
if (tree == NULL) {
@ -3265,7 +3265,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
if (attrDecl->atype == XML_ATTRIBUTE_ENUMERATION) {
xmlEnumerationPtr tree = attrDecl->tree;
while (tree != NULL) {
if (!xmlStrcmp(tree->name, value)) break;
if (xmlStrEqual(tree->name, value)) break;
tree = tree->next;
}
if (tree == NULL) {
@ -3278,7 +3278,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
/* Fixed Attribute Default */
if ((attrDecl->def == XML_ATTRIBUTE_FIXED) &&
(xmlStrcmp(attrDecl->defaultValue, value))) {
(!xmlStrEqual(attrDecl->defaultValue, value))) {
VERROR(ctxt->userData,
"Value for attribute %s on %s must be \"%s\"\n",
attr->name, elem->name, attrDecl->defaultValue);
@ -3352,7 +3352,7 @@ xmlValidateElementTypeExpr(xmlValidCtxtPtr ctxt, xmlNodePtr *child,
return(0);
case XML_ELEMENT_CONTENT_ELEMENT:
if (*child == NULL) return(0);
ret = (!xmlStrcmp((*child)->name, cont->name));
ret = (xmlStrEqual((*child)->name, cont->name));
if (ret == 1) {
while ((*child)->next == NULL) {
if (((*child)->parent != NULL) &&
@ -3738,11 +3738,11 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
cont = elemDecl->content;
while (cont != NULL) {
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) &&
(cont->c1 != NULL) &&
(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) ||
(cont->c1 == NULL) ||
(cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){
@ -3758,11 +3758,11 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
cont = elemDecl->content;
while (cont != NULL) {
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) &&
(cont->c1 != NULL) &&
(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) ||
(cont->c1 == NULL) ||
(cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)) {
@ -3813,7 +3813,7 @@ child_ok:
attrib = elem->properties;
while (attrib != NULL) {
if (!xmlStrcmp(attrib->name, attr->name)) {
if (xmlStrEqual(attrib->name, attr->name)) {
if (attr->prefix != NULL) {
xmlNsPtr nameSpace = attrib->ns;
@ -3827,7 +3827,7 @@ child_ok:
if (nameSpace == NULL) {
if (qualified < 0)
qualified = 0;
} else if (xmlStrcmp(nameSpace->prefix, attr->prefix)) {
} else if (!xmlStrEqual(nameSpace->prefix, attr->prefix)) {
if (qualified < 1)
qualified = 1;
} else
@ -3903,7 +3903,7 @@ xmlValidateRoot(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
/*
* 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)) {
xmlChar qname[500];
#ifdef HAVE_SNPRINTF
@ -3913,11 +3913,11 @@ xmlValidateRoot(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
sprintf((char *) qname, "%s:%s", root->ns->prefix, root->name);
#endif
qname[sizeof(qname) - 1] = 0;
if (!xmlStrcmp(doc->intSubset->name, qname))
if (xmlStrEqual(doc->intSubset->name, qname))
goto name_ok;
}
if ((!xmlStrcmp(doc->intSubset->name, BAD_CAST "HTML")) &&
(!xmlStrcmp(root->name, BAD_CAST "html")))
if ((xmlStrEqual(doc->intSubset->name, BAD_CAST "HTML")) &&
(xmlStrEqual(root->name, BAD_CAST "html")))
goto name_ok;
VERROR(ctxt->userData,
"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) {
case XML_ELEMENT_CONTENT_PCDATA:
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";
break;
case XML_ELEMENT_CONTENT_ELEMENT:
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;
break;
case XML_ELEMENT_CONTENT_SEQ:
@ -4375,7 +4375,7 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **list,
int 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];
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.
*/
} 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 @@@
*/
@ -150,16 +150,16 @@ xlinkIsLink (xmlDocPtr doc, xmlNodePtr node) {
*/
type = xmlGetNsProp(node, BAD_CAST"type", XLINK_NAMESPACE);
if (type != NULL) {
if (xmlStrcmp(type, BAD_CAST "simple")) {
if (!xmlStrEqual(type, BAD_CAST "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);
if (role != NULL) {
xmlNsPtr xlink;
xlink = xmlSearchNs(doc, node, XLINK_NAMESPACE);
if (xlink == NULL) {
/* Humm, fallback method */
if (!xmlStrcmp(role, BAD_CAST"xlink:external-linkset"))
if (xmlStrEqual(role, BAD_CAST"xlink:external-linkset"))
ret = XLINK_TYPE_EXTENDED_SET;
} else {
xmlChar buf[200];
@ -171,7 +171,7 @@ xlinkIsLink (xmlDocPtr doc, xmlNodePtr node) {
(char *) xlink->prefix);
#endif
buf[sizeof(buf) - 1] = 0;
if (!xmlStrcmp(role, buf))
if (xmlStrEqual(role, buf))
ret = XLINK_TYPE_EXTENDED_SET;
}

102
xpath.c
View File

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