Update of /cvsroot/refdb/refdb/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3548
Modified Files:
risxhandler.c
Log Message:
use elstack function prefix
Index: risxhandler.c
===================================================================
RCS file: /cvsroot/refdb/refdb/src/risxhandler.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -U2 -r1.28 -r1.29
--- risxhandler.c 16 Feb 2004 21:38:06 -0000 1.28
+++ risxhandler.c 17 May 2004 23:50:00 -0000 1.29
@@ -41,4 +41,5 @@
#include "refdbd.h" /* depends on backend.h */
#include "risdb.h"
+#include "elstack.h"
#include "xmlhandler.h"
#include "risxhandler.h"
@@ -711,9 +712,9 @@
result = 0;
- if (is_descendant_of(ptr_ardata->ptr_first, "part")) {
+ if (elstack_is_descendant_of(ptr_ardata->ptr_first, "part")) {
result = set_risdata_field(ptr_ardata->ptr_risdata, "title", (ptr_ardata->ptr_first)->ptr_elvalue, ptr_ardata->driver);
}
- else if (is_descendant_of(ptr_ardata->ptr_first, "publication")) {
- title_type = get_attr(ptr_ardata->ptr_first, "type");
+ else if (elstack_is_descendant_of(ptr_ardata->ptr_first, "publication")) {
+ title_type = elstack_get_attr(ptr_ardata->ptr_first, "type");
if (title_type && !strcmp(title_type, "full")) {
if (((ptr_ardata->perinfo).full = strdup((ptr_ardata->ptr_first)->ptr_elvalue)) == NULL || dbi_driver_quote_string(ptr_ardata->driver, &((ptr_ardata->perinfo).full)) == -1) {
@@ -742,5 +743,5 @@
}
}
- else if (title_type && !strcmp(title_type, "custabbrev1")) {
+ else if (title_type && !strcmp(title_type, "user1")) {
if (((ptr_ardata->perinfo).custabbrev1 = strdup((ptr_ardata->ptr_first)->ptr_elvalue)) == NULL || dbi_driver_quote_string(ptr_ardata->driver, &((ptr_ardata->perinfo).custabbrev1)) == -1) {
if ((new_msgpool = mstrcat(ptr_ardata->msgpool, outomem_n.text, &(ptr_ardata->msgpool_len), 0)) == NULL) {
@@ -755,5 +756,5 @@
}
}
- else if (title_type && !strcmp(title_type, "custabbrev2")) {
+ else if (title_type && !strcmp(title_type, "user2")) {
if (((ptr_ardata->perinfo).custabbrev2 = strdup((ptr_ardata->ptr_first)->ptr_elvalue)) == NULL || dbi_driver_quote_string(ptr_ardata->driver, &((ptr_ardata->perinfo).custabbrev2)) == -1) {
if ((new_msgpool = mstrcat(ptr_ardata->msgpool, outomem_n.text, &(ptr_ardata->msgpool_len), 0)) == NULL) {
@@ -768,5 +769,5 @@
}
}
- else {
+ else if (!title_type || !*title_type || !strcmp(title_type, "gen")){
if (!strcmp(ptr_ardata->type, "CHAP")
|| !strcmp(ptr_ardata->type, "CASE")
@@ -778,4 +779,11 @@
}
}
+ else {
+ /* this means we've received invalid risx data */
+ if ((new_msgpool = mstrcat(ptr_ardata->msgpool, "invalid title attribute", &(ptr_ardata->msgpool_len), 0)) == NULL) {
+ (ptr_ardata->ndb_error)++;
+ return;
+ }
+ }
}
else { /* set */
@@ -816,5 +824,5 @@
/* role attribute, function checks for NULL value */
- set_authorinfo_role(ptr_ardata->ptr_ainfo, get_attr(ptr_ardata->ptr_first, "role"));
+ set_authorinfo_role(ptr_ardata->ptr_ainfo, elstack_get_attr(ptr_ardata->ptr_first, "role"));
/* first check whether role is given explicitly */
@@ -834,5 +842,5 @@
/* now guess author type by occurrence */
- else if (is_descendant_of(ptr_ardata->ptr_first, "part")) {
+ else if (elstack_is_descendant_of(ptr_ardata->ptr_first, "part")) {
result = insert_author(ptr_ardata->ptr_ainfo, 1 /*primary author*/, ptr_ardata->authorpos, ptr_ardata->n_refdb_id, ptr_ardata->conn, ptr_ardata->driver, ptr_ardata->drivername);
if (!ptr_ardata->authorpos) {
@@ -841,5 +849,5 @@
}
}
- else if (is_descendant_of(ptr_ardata->ptr_first, "publication")) {
+ else if (elstack_is_descendant_of(ptr_ardata->ptr_first, "publication")) {
if (!strcmp(ptr_ardata->type, "ADVS")
|| !strcmp(ptr_ardata->type, "ART")
@@ -968,5 +976,5 @@
if (*(ptr_ardata->year) || *(ptr_ardata->month)
|| *(ptr_ardata->day) || *(ptr_ardata->otherinfo)) {
- pubtype = get_attr(ptr_ardata->ptr_first, "type");
+ pubtype = elstack_get_attr(ptr_ardata->ptr_first, "type");
if (pubtype && !strcmp(pubtype, "secondary")) {
ndate_type = 1;
@@ -999,5 +1007,5 @@
/* ------------------------------------------------------------ */
else if (!strcmp(el, "date")) {
- if (is_descendant_of(ptr_ardata->ptr_first, "reprint")) {
+ if (elstack_is_descendant_of(ptr_ardata->ptr_first, "reprint")) {
sprintf(ptr_ardata->date_buffer, "%s-%s-%s", ptr_ardata->year, ptr_ardata->month, ptr_ardata->day);
}
@@ -1209,5 +1217,5 @@
char tofield[6] = "user1";
- type = get_attr(ptr_ardata->ptr_first, "type");
+ type = elstack_get_attr(ptr_ardata->ptr_first, "type");
if (type) {
@@ -1249,5 +1257,5 @@
char tofield[6] = "misc1";
- type = get_attr(ptr_ardata->ptr_first, "type");
+ type = elstack_get_attr(ptr_ardata->ptr_first, "type");
if (type) {
@@ -1283,5 +1291,5 @@
char tofield[9] = "linkpdf";
- type = get_attr(ptr_ardata->ptr_first, "type");
+ type = elstack_get_attr(ptr_ardata->ptr_first, "type");
if (type) {
@@ -1350,5 +1358,5 @@
/* check whether we have a full string or one that relies on pdfroot */
- type = get_attr(ptr_ardata->ptr_first, "type");
+ type = elstack_get_attr(ptr_ardata->ptr_first, "type");
if (type && !strcmp(type, "useroot")) {
@@ -1407,5 +1415,5 @@
/* find out reprint type */
- rptype = get_attr(ptr_ardata->ptr_first, "status");
+ rptype = elstack_get_attr(ptr_ardata->ptr_first, "status");
if (!rptype || !strcmp(rptype, "NOTINFILE")) {
n_rptype = 1; /* not in file */
|