revert xsl for . and ..

This commit is contained in:
Olof Hagsand 2017-04-03 15:21:13 +02:00
parent 25d535703e
commit 18093441a8
9 changed files with 47 additions and 21 deletions

View file

@ -119,6 +119,7 @@ clicon_msg_decode(struct clicon_msg *msg,
/* body */
xmlstr = msg->op_body;
clicon_debug(1, "%s %s", __FUNCTION__, xmlstr);
if (clicon_xml_parse_str(xmlstr, xml) < 0)
goto done;
retval = 0;

View file

@ -606,7 +606,7 @@ clicon_rpc_discard_changes(clicon_handle h)
cxobj *xret = NULL;
cxobj *xerr;
if ((msg = clicon_msg_encode("<rpc><discard_changes/></rpc>")) == NULL)
if ((msg = clicon_msg_encode("<rpc><discard-changes/></rpc>")) == NULL)
goto done;
if (clicon_rpc_msg(h, msg, &xret, NULL) < 0)
goto done;

View file

@ -1011,7 +1011,7 @@ xmldb_get(clicon_handle h,
struct db_pair *pairs;
cxobj *xt = NULL;
clicon_debug(1, "%s", __FUNCTION__);
clicon_debug(2, "%s", __FUNCTION__);
if (db2file(h, db, &dbname) < 0)
goto done;
if (dbname==NULL){
@ -1065,8 +1065,8 @@ xmldb_get(clicon_handle h,
goto done;
if (xml_apply(xt, CX_ELMNT, xml_sanity, NULL) < 0)
goto done;
if (debug)
clicon_xml2file(stdout, xt, 0, 1);
if (debug>1)
clicon_xml2file(stderr, xt, 0, 1);
*xtop = xt;
retval = 0;
done:

View file

@ -199,7 +199,7 @@ xpath_parse_predicate(struct xpath_element *xe,
int len;
len = strlen(pred);
for (i=len-1; i>=0; i--){ /* -2 since we search for ][ */
for (i=len-1; i>=0; i--){ /* -1 since we search for ][ */
s = &pred[i];
if (i==0 ||
(*(s)==']' && *(s+1)=='[')){
@ -358,12 +358,23 @@ xpath_parse(char *xpath,
else if (strncmp(s,"descendant-or-self::", strlen("descendant-or-self::"))==0){
xpath_element_new(A_DESCENDANT_OR_SELF, s+strlen("descendant-or-self::"), &xpnext);
}
#if 1 /* Problems with .[userid=1321] */
else if (strncmp(s,".", strlen("."))==0)
xpath_element_new(A_SELF, s+strlen("."), &xpnext);
#else
else if (strncmp(s,".", strlen(s))==0) /* abbreviatedstep */
xpath_element_new(A_SELF, NULL, &xpnext);
#endif
else if (strncmp(s,"self::", strlen("self::"))==0)
xpath_element_new(A_SELF, s+strlen("self::"), &xpnext);
#if 1
else if (strncmp(s,"..", strlen(".."))==0) /* abbreviatedstep */
xpath_element_new(A_PARENT, s+strlen(".."), &xpnext);
#else
else if (strncmp(s,"..", strlen(s))==0) /* abbreviatedstep */
xpath_element_new(A_PARENT, NULL, &xpnext);
#endif
else if (strncmp(s,"parent::", strlen("parent::"))==0)
xpath_element_new(A_PARENT, s+strlen("parent::"), &xpnext);
else if (strncmp(s,"ancestor::", strlen("ancestor::"))==0)