{"id":23185,"date":"2013-05-13T17:01:40","date_gmt":"2013-05-13T11:31:40","guid":{"rendered":"http:\/\/vskills.in\/certification\/tutorial\/?p=23185"},"modified":"2024-04-12T14:23:51","modified_gmt":"2024-04-12T08:53:51","slug":"absolute-location-paths-and-descendant-selection","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/absolute-location-paths-and-descendant-selection\/","title":{"rendered":"Absolute Location paths and descendant selection"},"content":{"rendered":"<h2>Location Paths<\/h2>\n<p>Although there are many different kinds of XPath expressions, the one that\u2019s of primary use in Java programs is the\u00a0<i>location path<\/i>. A location path selects a set of nodes from an XML document. Each location path is composed of one or more\u00a0<i>location steps<\/i>. Each location step has an\u00a0<i>axis<\/i>, a\u00a0<i>node test<\/i>\u00a0and, optionally, one or more\u00a0<i>predicates<\/i>. Furthermore, each location step is evaluated with respect to a particular\u00a0<i>context node<\/i>. A double colon (<tt>::<\/tt>) separates the axis from the node test, and each predicate is enclosed in square brackets.<\/p>\n<h2>Example\u00a0Location Path<\/h2>\n<p>Consider the following XML document:<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Code<\/strong><\/span><\/p>\n<p>&lt;albums&gt;<br \/>\n&lt;rock&gt;<br \/>\n&lt;title&gt;Machine Head&lt;\/title&gt;<br \/>\n&lt;artist&gt;Deep Purple&lt;\/artist&gt;<br \/>\n&lt;\/rock&gt;<br \/>\n&lt;blues&gt;<br \/>\n&lt;title&gt;Greens From The Garden&lt;\/title&gt;<br \/>\n&lt;artist&gt;Cory Harris&lt;\/artist&gt;<br \/>\n&lt;\/blues&gt;<br \/>\n&lt;country&gt;<br \/>\n&lt;title&gt;The Ranch&lt;\/title&gt;<br \/>\n&lt;artist&gt;The Ranch&lt;\/artist&gt;<br \/>\n&lt;\/country&gt;<br \/>\n&lt;\/albums&gt;<\/p>\n<p>If we wanted to select the &#8220;title&#8221; node of all albums, we could use the following (absolute) location paths:<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Code<\/strong><\/span><\/p>\n<p>albums\/rock\/title<br \/>\nalbums\/blues\/title<br \/>\nalbums\/country\/title<\/p>\n<h3>The Result<\/h3>\n<p>Here are the nodes that are selected using the above location path.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Code<\/strong><\/span><\/p>\n<p>&lt;title&gt;Machine Head&lt;\/title&gt;<br \/>\n&lt;title&gt;Greens From The Garden&lt;\/title&gt;<br \/>\n&lt;title&gt;The Ranch&lt;\/title&gt;<\/p>\n<h2>The Root Node<\/h2>\n<p>If we wanted to select the root node, we could use either the node&#8217;s name or a forward slash. Both of these options are absolute location paths and select the root node.<\/p>\n<p>Option 1 &#8211; use the root node&#8217;s name:<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Code<\/strong><\/span><\/p>\n<p>albums<\/p>\n<p>Option 2 &#8211; use a forward slash:<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Code<\/strong><\/span><\/p>\n<div class=\"apply\">\n<h5>Go to- <a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/xml-developer\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>Certified XML Developer Tutorial<\/strong><\/a><\/h5>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Location Paths Although there are many different kinds of XPath expressions, the one that\u2019s of primary use in Java programs is the\u00a0location path. A location path selects a set of nodes from an XML document. Each location path is composed of one or more\u00a0location steps. Each location step has an\u00a0axis, a\u00a0node test\u00a0and, optionally, one or&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[3353],"tags":[4558,4557,4559,4561,4560,4562],"class_list":["post-23185","page","type-page","status-publish","hentry","category-xml","tag-absolute-location-paths","tag-absolute-location-paths-and-descendant-selection","tag-descendant-selection","tag-xml-absolute-location","tag-xml-descendant-selection","tag-xml-location-paths"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Absolute Location paths and descendant selection - Tutorial<\/title>\n<meta name=\"description\" content=\"Absolute Location paths and descendant selection\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/absolute-location-paths-and-descendant-selection\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Absolute Location paths and descendant selection - Tutorial\" \/>\n<meta property=\"og:description\" content=\"Absolute Location paths and descendant selection\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/absolute-location-paths-and-descendant-selection\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T08:53:51+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/absolute-location-paths-and-descendant-selection\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/absolute-location-paths-and-descendant-selection\/\",\"name\":\"Absolute Location paths and descendant selection - Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"datePublished\":\"2013-05-13T11:31:40+00:00\",\"dateModified\":\"2024-04-12T08:53:51+00:00\",\"description\":\"Absolute Location paths and descendant selection\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/absolute-location-paths-and-descendant-selection\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/absolute-location-paths-and-descendant-selection\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/absolute-location-paths-and-descendant-selection\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Absolute Location paths and descendant selection\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Absolute Location paths and descendant selection - Tutorial","description":"Absolute Location paths and descendant selection","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vskills.in\/certification\/tutorial\/absolute-location-paths-and-descendant-selection\/","og_locale":"en_US","og_type":"article","og_title":"Absolute Location paths and descendant selection - Tutorial","og_description":"Absolute Location paths and descendant selection","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/absolute-location-paths-and-descendant-selection\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T08:53:51+00:00","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/absolute-location-paths-and-descendant-selection\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/absolute-location-paths-and-descendant-selection\/","name":"Absolute Location paths and descendant selection - Tutorial","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"datePublished":"2013-05-13T11:31:40+00:00","dateModified":"2024-04-12T08:53:51+00:00","description":"Absolute Location paths and descendant selection","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/absolute-location-paths-and-descendant-selection\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/absolute-location-paths-and-descendant-selection\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/absolute-location-paths-and-descendant-selection\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Absolute Location paths and descendant selection"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/23185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=23185"}],"version-history":[{"count":4,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/23185\/revisions"}],"predecessor-version":[{"id":134027,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/23185\/revisions\/134027"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=23185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=23185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=23185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}