git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/trunk/XMLTree@263
3cdefd35-fc62-479d-8e8d-
bae585ffb9ca
\r
// If we found an attribute then "<@>" is present in the tree\r
// if we didn't then it is not. "<$>" is never present in the tree\r
\r
// If we found an attribute then "<@>" is present in the tree\r
// if we didn't then it is not. "<$>" is never present in the tree\r
- uint max_tag = 0;\r
- for(uint i=0;i<(uint)npar-1;i++)\r
- max_tag = max(max_tag,tags_aux[i]);\r
- max_tag++;\r
- tags_aux = (TagType *) urealloc(tags_aux, sizeof(TagType)*(npar + 1));\r
- tags_aux[npar++] = max_tag;\r
+ //uint max_tag = 0;\r
+ //for(uint i=0;i<(uint)npar-1;i++)\r
+ // max_tag = max(max_tag,tags_aux[i]);\r
+ //max_tag++;\r
+ //tags_aux = (TagType *) urealloc(tags_aux, sizeof(TagType)*(npar + 1));\r
+ //tags_aux[npar++] = max_tag;\r
//int ntagsize = found_attributes ? 2*ntagnames-1 : 2*ntagnames - 2;\r
int ntagsize = 2*ntagnames + 2;\r
\r
//int ntagsize = found_attributes ? 2*ntagnames-1 : 2*ntagnames - 2;\r
int ntagsize = 2*ntagnames + 2;\r
\r
// this should be changed for more efficient processing\r
for (i=0; i<ntagnames; i++)\r
if (strcmp((const char *)tagname,(const char *)TagName[i])==0) break; \r
// this should be changed for more efficient processing\r
for (i=0; i<ntagnames; i++)\r
if (strcmp((const char *)tagname,(const char *)TagName[i])==0) break; \r
- if (i==ntagnames) return ntagnames; //(TagType)NULLT; // tagname does not exists in the table\r
+ if (i==ntagnames) return (TagType)-1; //ntagnames; //(TagType)NULLT; // tagname does not exists in the table\r
unsigned char *XMLTree::GetTagName(TagType tagid)\r
{\r
unsigned char *s;\r
unsigned char *XMLTree::GetTagName(TagType tagid)\r
{\r
unsigned char *s;\r
+ if(tagid==(uint)-1) return NULL;\r
if (tagid >= ntagnames) return NULL; // invalid tag identifier\r
s = (unsigned char *)umalloc((strlen((const char *)TagName[tagid])+1)*sizeof(unsigned char));\r
strcpy((char *)s, (const char *)TagName[tagid]);\r
if (tagid >= ntagnames) return NULL; // invalid tag identifier\r
s = (unsigned char *)umalloc((strlen((const char *)TagName[tagid])+1)*sizeof(unsigned char));\r
strcpy((char *)s, (const char *)TagName[tagid]);\r
\r
const unsigned char *XMLTree::GetTagNameByRef(TagType tagid)\r
{\r
\r
const unsigned char *XMLTree::GetTagNameByRef(TagType tagid)\r
{\r
+ if(tagid==(uint)-1) return NULL;\r
if (tagid >= ntagnames) return NULL; // invalid tag identifier\r
return ((const unsigned char*) TagName[tagid]);\r
}\r
if (tagid >= ntagnames) return NULL; // invalid tag identifier\r
return ((const unsigned char*) TagName[tagid]);\r
}\r