{"id":21885,"date":"2015-03-31T11:00:00","date_gmt":"2015-03-31T08:00:00","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=21885"},"modified":"2015-03-30T11:52:08","modified_gmt":"2015-03-30T08:52:08","slug":"xpath-ends-with-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/","title":{"rendered":"XPath ends-with example"},"content":{"rendered":"<p>In this example we will learn how to use the <code>ends-with<\/code>\u00a0function of XPath. We will start with the introduction of XPath \u2013 what it is and how to use it, then we will see the working model of <code>ends-with<\/code>\u00a0function.<br \/>\nTools and technologies used in this example are Java 1.7, Maven, Intellij, Saxon.<\/p>\n<h2>1. Overview<\/h2>\n<p>An <strong>XPath<\/strong> expression specifies a pattern that selects a set of XML nodes. XSLT templates then use those patterns when applying transformations.\u00a0The nodes in an XPath expression refer to more than just elements. They also refer to text and attributes, among other things. In fact, the XPath specification defines an abstract document model that defines seven kinds of nodes:<\/p>\n<ul>\n<li>Root<\/li>\n<li>Element<\/li>\n<li>Text<\/li>\n<li>Attribute<\/li>\n<li>Comment<\/li>\n<li>Processing instruction<\/li>\n<li>Namespace<\/li>\n<\/ul>\n<p>XPath also provides rules for converting a node in an XML document object model (DOM) tree to a boolean, double, or string value.\u00a0XPath is a W3C-defined language and an official W3C recommendation; the W3C hosts the XML Path Language (XPath) Version 1.0 specification.<\/p>\n<h2>2. XPath Expressions<\/h2>\n<p>An XPath\u00a0<em>expression<\/em>\u00a0is composed of a\u00a0<em>location path<\/em>\u00a0and one or more optional\u00a0<em>predicates<\/em>. Expressions may also include XPath variables.<\/p>\n<p>The following is an example of a simple XPath expression:<\/p>\n<p><code>\/Country\/City<\/code><\/p>\n<p>This example would select the\u00a0<code>&lt;City&gt;<\/code>\u00a0element in an XML document<\/p>\n<p>ends-with(string1,string2), returns true if string1 ends with string2, otherwise it returns false<br \/>\nExample: ends-with(&#8216;JAVA&#8217;,&#8217;A&#8217;)<br \/>\nResult:\u00a0true<\/p>\n<h2>3. Project Structure<\/h2>\n<p>Below is the project structure used in this example<\/p>\n<p><figure id=\"attachment_21887\" aria-describedby=\"caption-attachment-21887\" style=\"width: 342px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/ProjectStructure.jpg\"><img decoding=\"async\" class=\"size-full wp-image-21887\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/ProjectStructure.jpg\" alt=\"Figure 1. Project Structure\" width=\"342\" height=\"380\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/ProjectStructure.jpg 342w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/ProjectStructure-270x300.jpg 270w\" sizes=\"(max-width: 342px) 100vw, 342px\" \/><\/a><figcaption id=\"caption-attachment-21887\" class=\"wp-caption-text\">Figure 1. Project Structure<\/figcaption><\/figure><\/p>\n<h2>4. XLM file<\/h2>\n<p>Below is the xml file representing Users. Each user has got a unique UserId, name, address, sex, Date Of Birth and email.<\/p>\n<p><span style=\"text-decoration: underline\"><em>user.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;Users&gt;\r\n    &lt;User&gt;\r\n        &lt;UserId&gt;12345&lt;\/UserId&gt;\r\n        &lt;Name&gt;\r\n            &lt;FirstName&gt;Maden&lt;\/FirstName&gt;\r\n            &lt;MiddleName&gt;Over&lt;\/MiddleName&gt;\r\n            &lt;Surname&gt;Gulliver&lt;\/Surname&gt;\r\n        &lt;\/Name&gt;\r\n        &lt;Address&gt;\r\n            &lt;FirstLineOfAddress&gt;Oxford Street&lt;\/FirstLineOfAddress&gt;\r\n            &lt;SecondLineOfAddress&gt;&lt;\/SecondLineOfAddress&gt;\r\n            &lt;City&gt;London&lt;\/City&gt;\r\n            &lt;County&gt;Middlesex&lt;\/County&gt;\r\n            &lt;Country&gt;United Kingdom&lt;\/Country&gt;\r\n        &lt;\/Address&gt;\r\n        &lt;Sex&gt;Male&lt;\/Sex&gt;\r\n        &lt;DateOfBirth&gt;01\/02\/1967&lt;\/DateOfBirth&gt;\r\n        &lt;Email&gt;&lt;\/Email&gt;\r\n    &lt;\/User&gt;\r\n    &lt;User&gt;\r\n        &lt;UserId&gt;56789&lt;\/UserId&gt;\r\n        &lt;Name&gt;\r\n            &lt;FirstName&gt;Tom&lt;\/FirstName&gt;\r\n            &lt;MiddleName&gt;Cruise&lt;\/MiddleName&gt;\r\n            &lt;Surname&gt;Kidman&lt;\/Surname&gt;\r\n        &lt;\/Name&gt;\r\n        &lt;Address&gt;\r\n            &lt;FirstLineOfAddress&gt;Reagent Street&lt;\/FirstLineOfAddress&gt;\r\n            &lt;SecondLineOfAddress&gt;&lt;\/SecondLineOfAddress&gt;\r\n            &lt;City&gt;New York&lt;\/City&gt;\r\n            &lt;County&gt;&lt;\/County&gt;\r\n            &lt;Country&gt;United States&lt;\/Country&gt;\r\n        &lt;\/Address&gt;\r\n        &lt;Sex&gt;Female&lt;\/Sex&gt;\r\n        &lt;DateOfBirth&gt;02\/03\/1978&lt;\/DateOfBirth&gt;\r\n        &lt;Email&gt;&lt;\/Email&gt;\r\n    &lt;\/User&gt;\r\n    &lt;User&gt;\r\n        &lt;UserId&gt;72638&lt;\/UserId&gt;\r\n        &lt;Name&gt;\r\n            &lt;FirstName&gt;Amitabh&lt;\/FirstName&gt;\r\n            &lt;MiddleName&gt;&lt;\/MiddleName&gt;\r\n            &lt;Surname&gt;Bachchan&lt;\/Surname&gt;\r\n        &lt;\/Name&gt;\r\n        &lt;Address&gt;\r\n            &lt;FirstLineOfAddress&gt;Panama Street&lt;\/FirstLineOfAddress&gt;\r\n            &lt;SecondLineOfAddress&gt;&lt;\/SecondLineOfAddress&gt;\r\n            &lt;City&gt;Mumbai&lt;\/City&gt;\r\n            &lt;County&gt;&lt;\/County&gt;\r\n            &lt;Country&gt;India&lt;\/Country&gt;\r\n        &lt;\/Address&gt;\r\n        &lt;Sex&gt;Male&lt;\/Sex&gt;\r\n        &lt;DateOfBirth&gt;05\/04\/1999&lt;\/DateOfBirth&gt;\r\n        &lt;Email&gt;amitabh.bachchan@asv.com&lt;\/Email&gt;\r\n    &lt;\/User&gt;\r\n&lt;\/Users&gt;<\/pre>\n<h2>5. Java file<\/h2>\n<p>Below is the java file which will use XPath to extract information from the <code>User.xml<\/code>.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><span style=\"text-decoration: underline\"><em>ExampleXPathEndsWith.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.javacodegeeks;\r\n\r\nimport net.sf.saxon.om.NamespaceConstant;\r\nimport org.w3c.dom.Document;\r\nimport org.w3c.dom.NodeList;\r\n\r\nimport javax.xml.parsers.DocumentBuilder;\r\nimport javax.xml.parsers.DocumentBuilderFactory;\r\nimport javax.xml.xpath.XPath;\r\nimport javax.xml.xpath.XPathConstants;\r\nimport javax.xml.xpath.XPathExpression;\r\nimport javax.xml.xpath.XPathFactory;\r\n\r\n\/**\r\n * Example to use XPath 'ends-with' function.\r\n * @author JavaCodeGeeks\r\n *\/\r\npublic class ExampleXPathEndsWith {\r\n\r\n    public static final String XPATH_EXPRESSION = \"\/\/User\/Address\/Country[ends-with(text(), \\\"Kingdom\\\")]\";\r\n    private DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();\r\n    private DocumentBuilder builder = null;\r\n\r\n    public static void main(String q[]) {\r\n        ExampleXPathEndsWith exampleXPathEndsWith = new ExampleXPathEndsWith();\r\n        exampleXPathEndsWith.execute();\r\n    }\r\n\r\n    private void execute() {\r\n        try{\r\n            System.setProperty(\"javax.xml.xpath.XPathFactory:\"+ NamespaceConstant.OBJECT_MODEL_SAXON, \"net.sf.saxon.xpath.XPathFactoryImpl\");\r\n            XPathFactory factory = XPathFactory.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON);\r\n            builder = builderFactory.newDocumentBuilder();\r\n            Document document = builder.parse(this.getClass().getResourceAsStream(\"\/user.xml\"));\r\n\r\n            XPath xpath = factory.newXPath();\r\n            XPathExpression expr = xpath.compile(XPATH_EXPRESSION);\r\n            Object result = expr.evaluate(document, XPathConstants.NODESET);\r\n            NodeList nodes = (NodeList) result;\r\n            System.out.println(nodes.item(0).getTextContent());\r\n        }\r\n        catch(Exception e){\r\n            e.printStackTrace();\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<h2>6.\u00a0pom.xml<\/h2>\n<p>Below is the pom.xml which has two dependencies for &#8216;saxon&#8217;.<\/p>\n<p><span style=\"text-decoration: underline\"><em>pom.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\"\r\n         xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\r\n    &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n\r\n    &lt;groupId&gt;com.javacodegeeks&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;xpath-ends-with&lt;\/artifactId&gt;\r\n    &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;\r\n\r\n    &lt;dependencies&gt;\r\n        &lt;dependency&gt;\r\n            &lt;groupId&gt;net.sf.saxon&lt;\/groupId&gt;\r\n            &lt;artifactId&gt;saxon-xpath&lt;\/artifactId&gt;\r\n            &lt;version&gt;8.7&lt;\/version&gt;\r\n        &lt;\/dependency&gt;\r\n        &lt;dependency&gt;\r\n            &lt;groupId&gt;net.sf.saxon&lt;\/groupId&gt;\r\n            &lt;artifactId&gt;saxon-dom&lt;\/artifactId&gt;\r\n            &lt;version&gt;8.7&lt;\/version&gt;\r\n        &lt;\/dependency&gt;\r\n\r\n    &lt;\/dependencies&gt;\r\n&lt;\/project&gt;<\/pre>\n<h2>7.\u00a0Saxon<\/h2>\n<p><code>ends-with<\/code> function is available in XPath 2.0. For this we use Saxon.<\/p>\n<p>This API is based on the class <code>net.sf.saxon.xpath.XPathEvaluator<\/code>. This class provides a few simple configuration interfaces to set the source document, the static context, and the context node, plus a number of methods for evaluating XPath expressions.<\/p>\n<p>There are two methods for direct evaluation of XPath expressions, <code>evaluate()<\/code> which returns a List containing the result of the expression (which in general is a sequence), and <code>evaluateSingle()<\/code> which returns the first item in the result (this is appropriate where it is known that the result will be single-valued). The results are returned as <code>NodeInfo<\/code> objects in the case of nodes, or as objects of the most appropriate Java class in the case of atomic values: for example, Boolean, Double, or String in the case of the traditional XPath 1.0 data types.<\/p>\n<h2>8. Output<\/h2>\n<p>Run the\u00a0<em>ExampleXPathEndsWith.java<\/em> file. Below is the generated output.<\/p>\n<pre class=\"brush:bash\">United Kingdom<\/pre>\n<h2>9. Download the source file<\/h2>\n<p>This was an example of <code>XPath 'ends-with'<\/code> function.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here :\u00a0<a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/XPath-Ends-With.zip\">XPath-Ends-With<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this example we will learn how to use the ends-with\u00a0function of XPath. We will start with the introduction of XPath \u2013 what it is and how to use it, then we will see the working model of ends-with\u00a0function. Tools and technologies used in this example are Java 1.7, Maven, Intellij, Saxon. 1. Overview An &hellip;<\/p>\n","protected":false},"author":34,"featured_media":1204,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[75],"tags":[],"class_list":["post-21885","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-xpath"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>XPath ends-with example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this example we will learn how to use the ends-with\u00a0function of XPath. We will start with the introduction of XPath \u2013 what it is and how to use it,\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"XPath ends-with example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this example we will learn how to use the ends-with\u00a0function of XPath. We will start with the introduction of XPath \u2013 what it is and how to use it,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-03-31T08:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Mohammad Meraj Zia\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mohammad Meraj Zia\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/\"},\"author\":{\"name\":\"Mohammad Meraj Zia\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/442b4f9b8a4aa7e12376464fc354f8ed\"},\"headline\":\"XPath ends-with example\",\"datePublished\":\"2015-03-31T08:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/\"},\"wordCount\":481,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"articleSection\":[\"XPath\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/\",\"name\":\"XPath ends-with example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"datePublished\":\"2015-03-31T08:00:00+00:00\",\"description\":\"In this example we will learn how to use the ends-with\u00a0function of XPath. We will start with the introduction of XPath \u2013 what it is and how to use it,\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"Bipartite Graph\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Core Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"xml\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/xml\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"XPath\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/xml\/xpath\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"XPath ends-with example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/442b4f9b8a4aa7e12376464fc354f8ed\",\"name\":\"Mohammad Meraj Zia\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/06\/IMG-20200324-WA0003-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/06\/IMG-20200324-WA0003-96x96.jpg\",\"caption\":\"Mohammad Meraj Zia\"},\"description\":\"Senior Java Developer\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\/\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/mohammad-zia\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"XPath ends-with example - Java Code Geeks","description":"In this example we will learn how to use the ends-with\u00a0function of XPath. We will start with the introduction of XPath \u2013 what it is and how to use it,","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:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/","og_locale":"en_US","og_type":"article","og_title":"XPath ends-with example - Java Code Geeks","og_description":"In this example we will learn how to use the ends-with\u00a0function of XPath. We will start with the introduction of XPath \u2013 what it is and how to use it,","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2015-03-31T08:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","type":"image\/jpeg"}],"author":"Mohammad Meraj Zia","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Mohammad Meraj Zia","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/"},"author":{"name":"Mohammad Meraj Zia","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/442b4f9b8a4aa7e12376464fc354f8ed"},"headline":"XPath ends-with example","datePublished":"2015-03-31T08:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/"},"wordCount":481,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","articleSection":["XPath"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/","name":"XPath ends-with example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","datePublished":"2015-03-31T08:00:00+00:00","description":"In this example we will learn how to use the ends-with\u00a0function of XPath. We will start with the introduction of XPath \u2013 what it is and how to use it,","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","width":150,"height":150,"caption":"Bipartite Graph"},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/xml\/xpath\/xpath-ends-with-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Core Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/"},{"@type":"ListItem","position":4,"name":"xml","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/xml\/"},{"@type":"ListItem","position":5,"name":"XPath","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/xml\/xpath\/"},{"@type":"ListItem","position":6,"name":"XPath ends-with example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/442b4f9b8a4aa7e12376464fc354f8ed","name":"Mohammad Meraj Zia","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/06\/IMG-20200324-WA0003-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/06\/IMG-20200324-WA0003-96x96.jpg","caption":"Mohammad Meraj Zia"},"description":"Senior Java Developer","sameAs":["http:\/\/www.javacodegeeks.com\/"],"url":"https:\/\/examples.javacodegeeks.com\/author\/mohammad-zia\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/21885","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/34"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=21885"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/21885\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1204"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=21885"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=21885"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=21885"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}