Skip to content

Commit

Permalink
Changed xmlCompileStepPattern() and xmlCompileAttributeTest() to handle
Browse files Browse the repository at this point in the history
* pattern.c: Changed xmlCompileStepPattern() and
  xmlCompileAttributeTest() to handle the "xml" prefix without
  caring if the XML namespace was supplied by the user.
  • Loading branch information
Kasimier T. Buchcik committed Jul 22, 2005
1 parent 2c9aac0 commit 627e9a9
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 34 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Sat Jul 23 00:34:07 CEST 2005 Kasimier Buchcik <[email protected]>

* pattern.c: Changed xmlCompileStepPattern() and
xmlCompileAttributeTest() to handle the "xml" prefix without
caring if the XML namespace was supplied by the user.

Fri Jul 22 00:08:43 CEST 2005 Kasimier Buchcik <[email protected]>

* xmlschemas.c: Fixed xmlSchemaPSimpleTypeErr(), which did not
Expand Down
88 changes: 54 additions & 34 deletions pattern.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,20 +905,26 @@ xmlCompileAttributeTest(xmlPatParserContextPtr ctxt) {
* This is a namespace match
*/
token = xmlPatScanName(ctxt);
for (i = 0;i < ctxt->nb_namespaces;i++) {
if (xmlStrEqual(ctxt->namespaces[2 * i + 1], prefix)) {
URL = xmlStrdup(ctxt->namespaces[2 * i]);
break;
if ((prefix[0] == 'x') &&
(prefix[1] == 'm') &&
(prefix[2] == 'l') &&
(prefix[3] == 0)) {
URL = xmlStrdup(XML_XML_NAMESPACE);
} else {
for (i = 0;i < ctxt->nb_namespaces;i++) {
if (xmlStrEqual(ctxt->namespaces[2 * i + 1], prefix)) {
URL = xmlStrdup(ctxt->namespaces[2 * i]);
break;
}
}
if (i >= ctxt->nb_namespaces) {
ERROR5(NULL, NULL, NULL,
"xmlCompileAttributeTest : no namespace bound to prefix %s\n",
prefix);
ctxt->error = 1;
goto error;
}
}
if (i >= ctxt->nb_namespaces) {
ERROR5(NULL, NULL, NULL,
"xmlCompileAttributeTest : no namespace bound to prefix %s\n",
prefix);
ctxt->error = 1;
goto error;
}

xmlFree(prefix);
if (token == NULL) {
if (CUR == '*') {
Expand Down Expand Up @@ -998,18 +1004,25 @@ xmlCompileStepPattern(xmlPatParserContextPtr ctxt) {
* This is a namespace match
*/
token = xmlPatScanName(ctxt);
for (i = 0;i < ctxt->nb_namespaces;i++) {
if (xmlStrEqual(ctxt->namespaces[2 * i + 1], prefix)) {
URL = xmlStrdup(ctxt->namespaces[2 * i]);
break;
if ((prefix[0] == 'x') &&
(prefix[1] == 'm') &&
(prefix[2] == 'l') &&
(prefix[3] == 0)) {
URL = xmlStrdup(XML_XML_NAMESPACE);
} else {
for (i = 0;i < ctxt->nb_namespaces;i++) {
if (xmlStrEqual(ctxt->namespaces[2 * i + 1], prefix)) {
URL = xmlStrdup(ctxt->namespaces[2 * i]);
break;
}
}
if (i >= ctxt->nb_namespaces) {
ERROR5(NULL, NULL, NULL,
"xmlCompileStepPattern : no namespace bound to prefix %s\n",
prefix);
ctxt->error = 1;
goto error;
}
}
if (i >= ctxt->nb_namespaces) {
ERROR5(NULL, NULL, NULL,
"xmlCompileStepPattern : no namespace bound to prefix %s\n",
prefix);
ctxt->error = 1;
goto error;
}
xmlFree(prefix);
if (token == NULL) {
Expand Down Expand Up @@ -1051,18 +1064,25 @@ xmlCompileStepPattern(xmlPatParserContextPtr ctxt) {
* This is a namespace match
*/
token = xmlPatScanName(ctxt);
for (i = 0;i < ctxt->nb_namespaces;i++) {
if (xmlStrEqual(ctxt->namespaces[2 * i + 1], prefix)) {
URL = xmlStrdup(ctxt->namespaces[2 * i]);
break;
if ((prefix[0] == 'x') &&
(prefix[1] == 'm') &&
(prefix[2] == 'l') &&
(prefix[3] == 0)) {
URL = xmlStrdup(XML_XML_NAMESPACE);
} else {
for (i = 0;i < ctxt->nb_namespaces;i++) {
if (xmlStrEqual(ctxt->namespaces[2 * i + 1], prefix)) {
URL = xmlStrdup(ctxt->namespaces[2 * i]);
break;
}
}
if (i >= ctxt->nb_namespaces) {
ERROR5(NULL, NULL, NULL,
"xmlCompileStepPattern : no namespace bound "
"to prefix %s\n", prefix);
ctxt->error = 1;
goto error;
}
}
if (i >= ctxt->nb_namespaces) {
ERROR5(NULL, NULL, NULL,
"xmlCompileStepPattern : no namespace bound "
"to prefix %s\n", prefix);
ctxt->error = 1;
goto error;
}
xmlFree(prefix);
if (token == NULL) {
Expand Down

0 comments on commit 627e9a9

Please sign in to comment.