if(c == '\n') /* add new line */
_line++;
-
- return(c);
+
+ return(c);
}
#define FGETC(fp) _xml_fgetc(fp)
vfprintf(stderr, msg, args);
fprintf(stderr, "\n\n");
#endif
-
+
memset(_lxml->err,'\0', 128);
vsnprintf(_lxml->err,127,msg,args);
va_end(args);
free(_lxml->ck);
free(_lxml->ln);
memset(_lxml->err,'\0', 128);
-
+
return;
-
+
}
return(-1);
}
}
-
+
fclose(fp);
return(0);
}
char closedelem[XML_MAXSIZE +1];
-
+
memset(elem,'\0',XML_MAXSIZE +1);
memset(cont,'\0',XML_MAXSIZE +1);
memset(closedelem,'\0',XML_MAXSIZE +1);
else if(r == 1)
continue;
}
-
+
/* real checking */
if((location == -1) && (prevv == 0))
{
else
continue;
}
-
+
else if((location == 0) && ((c == _R_CONFE) || (c == ' ')))
{
int _ge = 0;
_ge = '/';
elem[count -1] = '\0';
}
-
+
_writememory(elem, XML_ELEM, count+1, parent, _lxml);
_currentlycont=_lxml->cur-1;
if(c == ' ')
_currentlycont = 0;
count = 0;
location = -1;
-
+
memset(elem,'\0',XML_MAXSIZE);
memset(closedelem,'\0',XML_MAXSIZE);
memset(cont,'\0',XML_MAXSIZE);
-
+
if(parent > 0)
return(0);
}
{
count = 0;
location = 1;
- }
+ }
}
-
+
else if((location == 2) &&(c == _R_CONFE))
{
closedelem[count]='\0';
/* Allocating for the line */
_lxml->ln = realloc(_lxml->ln,(_lxml->cur+1)*sizeof(int));
_lxml->ln[_lxml->cur] = _line;
-
+
/* Attributes does not need to be closed */
if(type == XML_ATTR)
_lxml->ck[_lxml->cur] = 1;
int count = 0;
int c;
int c_to_match = 0;
-
+
char attr[XML_MAXSIZE+1];
char value[XML_MAXSIZE+1];
if(count >= XML_MAXSIZE)
{
attr[count-1] = '\0';
- xml_error(_lxml,
+ xml_error(_lxml,
"XMLERR: Overflow attempt at attribute '%s'.",attr);
return(-1);
}
else if((location == 1)&&(c == c_to_match))
{
value[count]='\0';
-
+
location = 0;
c_to_match = 0;
-
- _writememory(attr, XML_ATTR, strlen(attr)+1,
+
+ _writememory(attr, XML_ATTR, strlen(attr)+1,
parent, _lxml);
_writecontent(value,count+1,_lxml->cur-1,_lxml);
c = FGETC(fp);
value[count++]=c;
}
-
+
xml_error(_lxml, "XMLERR: End of file while reading an attribute.");
return(-1);
}