if (root_id)
{
void *path_id, *node_id;
+ char *s;
- path_id = xmlNodeGet(root_id, PATH);
- node_id = xmlNodeGet(root_id, ROOTNODE);
-
- if (path_id && node_id)
+ printf("\nTesting xmlNodeGetString for /Configuration/output/test:\t\t");
+ s = xmlNodeGetString(root_id , "/Configuration/output/test");
+ if (s)
{
- char buf[BUFLEN];
- size_t len;
- char *s;
-
- len = xmlNodeCopyString(root_id, PATH, buf, BUFLEN);
- printf("%s = '%s'\n", PATH, buf);
+ printf("failed.\n\t'%s' should be empty\n", s);
+ free(s);
+ }
+ else
+ printf("succes.\n");
- printf("Testing value of /Configuration/output/test:\t\t\t\t");
- s = xmlNodeGetString(root_id , "/Configuration/output/test");
+ printf("Testing xmlGetString for Configuration/output/test:\t\t\t");
+ path_id = xmlNodeGet(root_id, "*/*/test");
+ if (path_id)
+ {
+ s = xmlGetString(path_id);
if (s)
{
- printf("failed.\n\t'%s' shoudl be empty\n", s);
+ printf("failed.\n\t'%s' should be empty\n", s);
free(s);
}
else
printf("succes.\n");
+ }
+
+ path_id = xmlNodeGet(root_id, PATH);
+ node_id = xmlNodeGet(root_id, ROOTNODE);
+
+ if (path_id && node_id)
+ {
+ char buf[BUFLEN];
+ size_t len;
+
+ xmlCopyString(path_id, buf, BUFLEN);
printf("Testing xmlNodeCopyString against xmlGetString:\t\t\t\t");
if ((s = xmlGetString(path_id)) != 0)
xmlClose(root_id);
}
+ printf("\n");
return 0;
}
cur = new;
}
+ if (*cur == '/') /* closing tag of leaf node found */
+ {
+ if (!strncasecmp(new+1, element, elementlen))
+ {
+ if (*(new+elementlen+1) != '>')
+ SET_ERROR_AND_RETURN(new+1, XML_ELEMENT_NO_CLOSING_TAG);
+
+ if (found == num)
+ {
+ if (start_tag)
+ {
+ *len = new-ret-1;
+ open_element = start_tag;
+ cdata = (char *)start;
+ start_tag = 0;
+ }
+ else /* report error */
+ SET_ERROR_AND_RETURN(new, XML_ELEMENT_NO_OPENING_TAG);
+ }
+ found++;
+ }
+
+ new = memchr(cur, '>', restlen);
+ if (!new)
+ SET_ERROR_AND_RETURN(cur, XML_ELEMENT_NO_CLOSING_TAG);
+
+ restlen -= new-cur;
+ cur = new;
+ continue;
+ }
+
+ /* no leaf node, continue */
if (*cur != '/') /* cascading tag found */
{
char *node = "*";
new = __xmlCommentSkip(cur, restlen);
if (new)
{
- *start += 3; /* !-- */
- *len = (*start-cur)-3; /* --> */
+ *start = new;
+ *len = 0;
}
return new;
}
{
if ((restlen > 3) && (memcmp(new, "]]>", 3) == 0))
{
- *len = new - *start;
+ *len = new-1 - *start;
restlen -= 3;
new += 3;
break;
new = memchr(cur, '-', len);
if (new)
{
- len -= new - cur;
+ len -= new-cur;
if ((len >= 3) && (memcmp(new, "-->", 3) == 0))
{
new += 3;
- len -= 3;
+ /* len -= 3; */
break;
}
cur = new+1;
+ len -= cur-new;
}
else break;
}
size_t blocklen = len-1;
if (blocklen >= 6) /* !-- --> */
{
- char *new = __xmlProcessCDATA(&start, &blocklen);
+ char *new = __xmlProcessCDATA(&start, &len);
if (new)
{
ps = start;
- len = blocklen;
pe = ps + len;
while ((ps<pe) && isspace(*ps)) ps++;