* changes to the code to allow walking the xml-tree using "*" as a node name
This commit is contained in:
parent
bdccfb587d
commit
9e36b86756
2 changed files with 11 additions and 17 deletions
|
@ -1,9 +1,11 @@
|
|||
28-04-2009
|
||||
* changes to the code to allow walking the xml-tree using "*" as a node name
|
||||
|
||||
27-04-2009
|
||||
* add xmlInitBuffer() for processing of a preallocated buffer
|
||||
* add xmlErrorGetColumnNo to get the column number of the syntax error
|
||||
* pass an error at a higher level to lower levels
|
||||
* detect a number of extra syntax errors
|
||||
* fix a buffer overflow
|
||||
|
||||
26-04-2009
|
||||
* add support for comments inside xml-tags, e.g.: <test><!-- --></test>
|
||||
|
|
|
@ -1396,9 +1396,11 @@ __xmlNodeGetPath(const char *start, size_t *len, char **name, size_t *plen)
|
|||
char *
|
||||
__xmlNodeGet(const char *start, size_t *len, char **name, size_t *rlen, size_t *nodenum)
|
||||
{
|
||||
char *element, *open_element, *start_tag=0;
|
||||
char *open_element = *name;
|
||||
char *element, *start_tag=0;
|
||||
char *new, *cur, *ne, *ret = 0;
|
||||
size_t restlen, elementlen;
|
||||
size_t open_len = *rlen;
|
||||
size_t return_len = 0;
|
||||
int found, num;
|
||||
|
||||
|
@ -1474,7 +1476,6 @@ __xmlNodeGet(const char *start, size_t *len, char **name, size_t *rlen, size_t *
|
|||
/*
|
||||
* get element name and a pointer to after the opening tag
|
||||
*/
|
||||
open_element = cur;
|
||||
element = *name;
|
||||
elementlen = *rlen;
|
||||
len_remaining = restlen;
|
||||
|
@ -1485,8 +1486,8 @@ __xmlNodeGet(const char *start, size_t *len, char **name, size_t *rlen, size_t *
|
|||
if (found == num)
|
||||
{
|
||||
ret = new;
|
||||
open_len = elementlen;
|
||||
start_tag = element;
|
||||
*rlen = elementlen;
|
||||
}
|
||||
else start_tag = 0;
|
||||
}
|
||||
|
@ -1510,7 +1511,7 @@ __xmlNodeGet(const char *start, size_t *len, char **name, size_t *rlen, size_t *
|
|||
{
|
||||
if (found == num)
|
||||
{
|
||||
*name = start_tag;
|
||||
open_element = start_tag;
|
||||
*len = 0;
|
||||
}
|
||||
found++;
|
||||
|
@ -1631,7 +1632,7 @@ __xmlNodeGet(const char *start, size_t *len, char **name, size_t *rlen, size_t *
|
|||
if (start_tag)
|
||||
{
|
||||
*len = new-ret-1;
|
||||
*name = start_tag;
|
||||
open_element = start_tag;
|
||||
}
|
||||
else /* report error */
|
||||
{
|
||||
|
@ -1643,16 +1644,6 @@ __xmlNodeGet(const char *start, size_t *len, char **name, size_t *rlen, size_t *
|
|||
}
|
||||
found++;
|
||||
}
|
||||
#ifndef XML_NONVALIDATING
|
||||
/* strcmp is a heavy operation when not required */
|
||||
else if (strncmp(open_element, new+1, elementlen))
|
||||
{
|
||||
*rlen = 0;
|
||||
*name = new+1;
|
||||
*len = XML_ELEMENT_NO_CLOSING_TAG;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
new = memchr(cur, '>', restlen);
|
||||
if (!new)
|
||||
|
@ -1684,7 +1675,8 @@ __xmlNodeGet(const char *start, size_t *len, char **name, size_t *rlen, size_t *
|
|||
}
|
||||
else
|
||||
{
|
||||
*rlen = return_len;
|
||||
*rlen = open_len;
|
||||
*name = open_element;
|
||||
*nodenum = found;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue