CINXE.COM

Apache Commons JXPath – JXPath Home

<!DOCTYPE html> <!-- | Generated by Apache Maven Doxia at 18 November 2015 | Rendered using Apache Maven Fluido Skin 1.3.0 --> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta charset="iso-8859-1" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="author" content="Commons Documentation Team" /> <meta name="author" content="Dmitri Plotnikov" /> <meta name="Date-Revision-yyyymmdd" content="20151118" /> <meta http-equiv="Content-Language" content="en" /> <title>Apache Commons JXPath &#x2013; JXPath Home</title> <link rel="stylesheet" href="./css/bootstrap.min.css" type="text/css" /> <link rel="stylesheet" href="./css/site.css" type="text/css" /> <link rel="stylesheet" href="./css/print.css" media="print" /> <script type="text/javascript" src="./js/jquery.min.js"></script> <script type="text/javascript" src="./js/bootstrap.min.js"></script> <script type="text/javascript" src="./js/prettify.min.js"></script> <script type="text/javascript" src="./js/site.js"></script> <link rel="stylesheet" type="text/css" media="all" href="./css/prettify.css"/> <script src="./js/prettify.js" type="text/javascript"></script> <script type="text/javascript">window.onload=function() { prettyPrint(); }</script> </head> <body class="composite"> <a href="http://commons.apache.org/" id="bannerLeft" title="Apache Commons logo"> <img class="logo-left" src="./images/commons-logo.png" alt="Apache Commons logo"/> </a> <a href="../../jxpath/" id="bannerRight"> <img class="logo-right" src="../../jxpath/images/logo-wbg.jpg" alt="Commons JXPath"/> </a> <div class="clear"></div> <div class="navbar"> <div class="navbar-inner"> <div class="container-fluid"> <a class="brand" href="http://commons.apache.org/proper/commons-jxpath/">Apache Commons JXPath &trade;</a> <ul class="nav"> <li id="publishDate">Last Published: 18 November 2015</li> <li class="divider">|</li> <li id="projectVersion">Version: 1.4-SNAPSHOT</li> </ul> <div class="pull-right"> <ul class="nav"> <li> <a href="http://www.apachecon.com/" class="externalLink" title="ApacheCon"> ApacheCon</a> </li> <li> <a href="http://www.apache.org" class="externalLink" title="Apache"> Apache</a> </li> <li> <a href="../../" title="Commons"> Commons</a> </li> </ul> </div> </div> </div> </div> <div class="container-fluid"> <table class="layout-table"> <tr> <td class="sidebar"> <div class="well sidebar-nav"> <ul class="nav nav-list"> <li class="nav-header">JXPath</li> <li class="none active"> <a href="index.html" title="Overview"> Overview</a> </li> <li class="none"> <a href="../../jxpath/download_jxpath.cgi" title="Download"> Download</a> </li> <li class="none"> <a href="users-guide.html" title="User's Guide"> User's Guide</a> </li> <li class="none"> <a href="apidocs/index.html" title="JavaDoc"> JavaDoc</a> </li> <li class="none"> <a href="release-notes-1.3.html" title="Release Notes"> Release Notes</a> </li> <li class="none"> <a href="dependencies.html" title="Dependencies"> Dependencies</a> </li> <li class="none"> <a href="license.html" title="License"> License</a> </li> <li class="none"> <a href="http://wiki.apache.org/commons/JXPath" class="externalLink" title="Wiki"> Wiki</a> </li> </ul> <ul class="nav nav-list"> <li class="nav-header">JXPath 1.3</li> <li class="none"> <a href="javadocs/api-1.3/" title="JavaDoc"> JavaDoc</a> </li> <li class="none"> <a href="release-notes-1.3.html" title="Release Notes"> Release Notes</a> </li> </ul> <ul class="nav nav-list"> <li class="nav-header">JXPath 1.2</li> <li class="none"> <a href="javadocs/api-1.2/" title="Javadoc"> Javadoc</a> </li> <li class="none"> <a href="../../jxpath/release-notes-1.2.html" title="Release Notes"> Release Notes</a> </li> </ul> <ul class="nav nav-list"> <li class="nav-header">JXPath 1.1</li> <li class="none"> <a href="javadocs/api-1.1/" title="Javadoc"> Javadoc</a> </li> <li class="none"> <a href="../../jxpath/release-notes-1.1.html" title="Release Notes"> Release Notes</a> </li> </ul> <ul class="nav nav-list"> <li class="nav-header"><i class="icon-cog"></i>Development</li> <li class="none"> <a href="mail-lists.html" title="Mailing Lists"> Mailing Lists</a> </li> <li class="none"> <a href="issue-tracking.html" title="Issue Tracking"> Issue Tracking</a> </li> <li class="none"> <a href="apidocs/index.html" title="Latest JavaDoc"> Latest JavaDoc</a> </li> <li class="none"> <a href="source-repository.html" title="Source Repository"> Source Repository</a> </li> <li class="none"> <a href="building.html" title="Building"> Building</a> </li> </ul> <ul class="nav nav-list"> <li class="nav-header"><i class="icon-info-sign"></i>Project Documentation</li> <li class="expanded"> <a href="project-info.html" title="Project Information"> Project Information</a> <ul> <li class="none active"> <a href="index.html" title="About"> About</a> </li> <li class="none"> <a href="project-summary.html" title="Project Summary"> Project Summary</a> </li> <li class="none"> <a href="team-list.html" title="Project Team"> Project Team</a> </li> <li class="none"> <a href="source-repository.html" title="Source Repository"> Source Repository</a> </li> <li class="none"> <a href="issue-tracking.html" title="Issue Tracking"> Issue Tracking</a> </li> <li class="none"> <a href="mail-lists.html" title="Mailing Lists"> Mailing Lists</a> </li> <li class="none"> <a href="dependency-info.html" title="Dependency Information"> Dependency Information</a> </li> <li class="none"> <a href="dependency-management.html" title="Dependency Management"> Dependency Management</a> </li> <li class="none"> <a href="dependencies.html" title="Dependencies"> Dependencies</a> </li> <li class="none"> <a href="dependency-convergence.html" title="Dependency Convergence"> Dependency Convergence</a> </li> <li class="none"> <a href="integration.html" title="Continuous Integration"> Continuous Integration</a> </li> <li class="none"> <a href="distribution-management.html" title="Distribution Management"> Distribution Management</a> </li> </ul> </li> <li class="collapsed"> <a href="project-reports.html" title="Project Reports"> Project Reports</a> </li> </ul> <ul class="nav nav-list"> <li class="nav-header">Commons</li> <li class="none"> <a href="../../" title="Home"> Home</a> </li> <li class="none"> <a href="http://www.apache.org/licenses/" class="externalLink" title="License"> License</a> </li> <li class="collapsed"> <a href="../../components.html" title="Components"> Components</a> </li> <li class="collapsed"> <a href="../../sandbox/index.html" title="Sandbox"> Sandbox</a> </li> <li class="collapsed"> <a href="../../dormant/index.html" title="Dormant"> Dormant</a> </li> </ul> <ul class="nav nav-list"> <li class="nav-header">General Information</li> <li class="none"> <a href="../../security.html" title="Security"> Security</a> </li> <li class="none"> <a href="../../volunteering.html" title="Volunteering"> Volunteering</a> </li> <li class="none"> <a href="../../patches.html" title="Contributing Patches"> Contributing Patches</a> </li> <li class="none"> <a href="../../building.html" title="Building Components"> Building Components</a> </li> <li class="none"> <a href="../../commons-parent-pom.html" title="Commons Parent Pom"> Commons Parent Pom</a> </li> <li class="none"> <a href="../../build-plugin/index.html" title="Commons Build Plugin"> Commons Build Plugin</a> </li> <li class="none"> <a href="../../releases/index.html" title="Releasing Components"> Releasing Components</a> </li> <li class="none"> <a href="http://wiki.apache.org/commons/FrontPage" class="externalLink" title="Wiki"> Wiki</a> </li> </ul> <ul class="nav nav-list"> <li class="nav-header">ASF</li> <li class="none"> <a href="http://www.apache.org/foundation/how-it-works.html" class="externalLink" title="How the ASF works"> How the ASF works</a> </li> <li class="none"> <a href="http://www.apache.org/foundation/getinvolved.html" class="externalLink" title="Get Involved"> Get Involved</a> </li> <li class="none"> <a href="http://www.apache.org/dev/" class="externalLink" title="Developer Resources"> Developer Resources</a> </li> <li class="none"> <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship"> Sponsorship</a> </li> <li class="none"> <a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"> Thanks</a> </li> </ul> </div> <div id="poweredBy"> <a href="http://www.apache.org/events/current-event.html" title="ApacheCon" class="builtBy"> <img class="builtBy" alt="ApacheCon" src="http://www.apache.org/events/current-event-125x125.png" /> </a> <a href="http://maven.apache.org/" title="Maven" class="builtBy"> <img class="builtBy" alt="Maven" src="http://maven.apache.org/images/logos/maven-feather.png" /> </a> </div> </td> <td class="content"> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <div class="section"> <h2><a name="The_JXPath_Component"></a>The JXPath Component</h2> <p> The <tt>org.apache.commons.jxpath</tt> package defines a simple interpreter of an expression language called XPath. JXPath applies <i>XPath</i> expressions to graphs of objects of all kinds: JavaBeans, Maps, Servlet contexts, DOM etc, including mixtures thereof. </p> <p> Consider this example: </p> <blockquote> <div> <pre> Address address = (Address)JXPathContext.newContext(vendor). getValue(&quot;locations[address/zipCode='90210']/address&quot;); </pre></div></blockquote> <p> This XPath expression is equivalent to the following Java code: </p> <blockquote> <div> <pre> Address address = null; Collection locations = vendor.getLocations(); Iterator it = locations.iterator(); while (it.hasNext()){ Location location = (Location)it.next(); String zipCode = location.getAddress().getZipCode(); if (zipCode.equals(&quot;90210&quot;)){ address = location.getAddress(); break; } } </pre></div></blockquote> <p> XPath was standardized by W3C and is used in both XSLT and XPointer. </p> <p> If you want to find out more about XPath, a good place to start is an excellent XPath Tutorial by <a class="externalLink" href="http://www.w3schools.com/xpath">W3Schools</a> </p> <p> The official definition of XPath by W3C can be found at <a class="externalLink" href="http://www.w3.org/TR/xpath">XML Path Language (XPath) Version 1.0</a> </p> <p> Primary applications of JXPath are in scripting: JSP and similar template/script based technologies. However, programmers who prefer XML-flavored APIs, should consider JXPath as an alternative to other expression languages as well. JXPath is a must-have tool for those who work with mixtures of Java objects and XML and need to frequently traverse through graphs of those. </p> <p> JXPath documentation currently contains: </p> <ul> <li><a href="users-guide.html">User's Guide</a></li> <li><a href="apidocs/index.html">JavaDoc API Documentation</a></li> <!-- <li><a href="design.html">JXPath Design</a>, which is a document primarily intended for those who are interested in extending JXPath. It could also be quite useful if you are debugging a tough problem. </li> --> </ul> </div> <div class="section"> <h2><a name="Releases"></a>Releases</h2> <p>See the <a class="externalLink" href="http://commons.apache.org/jxpath/download_jxpath.cgi">JXPath Downloads</a> page for current/previous releases. </p> </div> </td> </tr> </table> </div> <div class="footer"> <p>Copyright &copy; 2001-2015 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.</p> <div class="center">Apache Commons, Apache Commons JXPath, Apache, the Apache feather logo, and the Apache Commons project logos are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.</div> </div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10