{"id":766,"date":"2020-01-09T13:15:24","date_gmt":"2020-01-09T13:15:24","guid":{"rendered":"https:\/\/sdf-docs.mansystems.com\/docs\/acr-rules\/reliability\/check-for-negative-conditions-in-xpath-should-be-done-using-not-instead-of\/"},"modified":"2020-03-20T08:44:58","modified_gmt":"2020-03-20T08:44:58","slug":"negativeconditionxpath","status":"publish","type":"docs","link":"https:\/\/sdf-docs.clevr.com\/?docs=acr-rules\/reliability\/negativeconditionxpath","title":{"rendered":"Check for negative conditions in XPath should be done using not instead of !="},"content":{"rendered":"\n<p style=\"text-align:center\">Introduced in version: 1.3 (29 Jan 2020)<\/p>\n\n\n\n<p>&#8216;This is very likely a bug and should be changed. Negative conditions in Xpath do not work as intuitively expected. <\/p>\n\n\n\n<p><strong>Noncompliant example:<\/strong><\/p>\n\n\n\n<p><code>[Module.Association\/Module.Entity\/Module.Association2 != empty]<br>[Module.Association\/Module.Entity\/Module.Association2\/Module.Entity\/SomeAttribute != $Value]<\/code><\/p>\n\n\n\n<p>the above will return false also when the path does not exist. <br> To fix this &#8220;not&#8221; has to be used.<\/p>\n\n\n\n<p><strong>Compliant example:<\/strong><\/p>\n\n\n\n<p><code>[not(Module.Association\/Module.Entity\/Module.Association2 = empty)]<\/code><br> <code>[not(Module.Association\/Module.Entity\/Module.Association2\/Module.Entity\/SomeAttribute = $Value)] <\/code><\/p>\n\n\n\n<p>&#8216;<\/p>\n","protected":false},"featured_media":0,"parent":97,"menu_order":29,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-766","docs","type-docs","status-publish","hentry"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/766"}],"collection":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=766"}],"version-history":[{"count":3,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/766\/revisions"}],"predecessor-version":[{"id":769,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/766\/revisions\/769"}],"up":[{"embeddable":true,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/97"}],"next":[{"title":"Declared variables should be used","link":"https:\/\/sdf-docs.clevr.com\/?docs=acr-rules\/reliability\/unusedvariable","href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/701"}],"prev":[{"title":"Associations should specify a delete behaviour","link":"https:\/\/sdf-docs.clevr.com\/?docs=acr-rules\/reliability\/nodeletebehaviour","href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/253"}],"wp:attachment":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=766"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdoc_tag&post=766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}