{"id":26,"date":"2006-09-25T18:51:06","date_gmt":"2006-09-26T01:51:06","guid":{"rendered":"http:\/\/www.corneliadavis.com\/blog\/?p=26"},"modified":"2006-09-25T18:51:06","modified_gmt":"2006-09-26T01:51:06","slug":"xml-spy-bug-predicate-evaluation-order","status":"publish","type":"post","link":"https:\/\/corneliadavis.com\/blog\/2006\/09\/25\/xml-spy-bug-predicate-evaluation-order\/","title":{"rendered":"XML Spy bug: predicate evaluation order"},"content":{"rendered":"<p>The <a href=\"http:\/\/www.w3.org\/TR\/xpath20\">Xpath 2.0<\/a> specification describes <a href=\"http:\/\/www.w3.org\/TR\/xpath20\/#id-predicates\">predicates<\/a> and specifically predicate ordering with<\/p>\n<blockquote><p>&#8220;In the case of multiple adjacent predicates, the predicates are applied from left to right, and the result of applying each predicate serves as the input sequence for the following predicate.&#8221;<\/p><\/blockquote>\n<p>Unfortunately <a href=\"http:\/\/www.altova.com\/products\/xmlspy\/xml_editor.html\">XML Spy<\/a> seems to have a bug.  Given the following example, again taken from the Xpath 2.0 spec:<\/p>\n<pre>&lt;bib&gt;&lt;book&gt;&lt;title&gt;TCP\/IP Illustrated&lt;\/title&gt;&lt;author&gt;Stevens&lt;\/author&gt;&lt;publisher&gt;Addison-Wesley&lt;\/publisher&gt;&lt;\/book&gt;&lt;book&gt;&lt;title&gt;Advanced Programming in the Unix Environment&lt;\/title&gt;&lt;author&gt;Stevens&lt;\/author&gt;&lt;publisher&gt;Addison-Wesley&lt;\/publisher&gt;&lt;\/book&gt;&lt;book&gt;&lt;title&gt;Data on the Web&lt;\/title&gt;&lt;author&gt;Abiteboul&lt;\/author&gt;&lt;author&gt;Buneman&lt;\/author&gt;&lt;author&gt;Suciu&lt;\/author&gt;&lt;\/book&gt;&lt;\/bib&gt;<\/pre>\n<p>The Xpath expression (evaluated from the root) of <code>bib\/book\/author[. = \"Stevens\"][1]<\/code> should evaluate to a single author element with the value &#8220;Stevens&#8221; &#8211; that is, it should, by the definition cited above, evaluate to the same thing as <code>(bib\/book\/author[. = \"Stevens\"])[1]<\/code>.  Unfortunately it does not &#8211; the former evaluates to <strong>two<\/strong> author elements with the value &#8220;Stevens&#8221;, the latter evaluates to a <strong>single<\/strong> author element with the value &#8220;Stevens&#8221;.Bummer.I am running XML Spy version 2006, sp2 &#8211; Enterprise Edition.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Xpath 2.0 specification describes predicates and specifically predicate ordering with &#8220;In the case of multiple adjacent predicates, the predicates are applied from left to right, and the result of applying each predicate serves as the input sequence for the following predicate.&#8221; Unfortunately XML Spy seems to have a bug. Given the following example, again [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[41,43],"tags":[],"class_list":["post-26","post","type-post","status-publish","format-standard","hentry","category-xml","category-xpath"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/posts\/26","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/comments?post=26"}],"version-history":[{"count":0,"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/posts\/26\/revisions"}],"wp:attachment":[{"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/media?parent=26"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/categories?post=26"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/corneliadavis.com\/blog\/wp-json\/wp\/v2\/tags?post=26"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}