XPath, the XML Path Language, is a query language for selecting nodes from an XML document. In addition, XPath may be used to compute values (e.g., strings, numbers, or Boolean values) from the content of an XML document. XPath was defined by the World Wide Web Consortium (W3C).
The XPath language is based on a tree representation of the XML document, and provides the ability to navigate around the tree, selecting nodes by a variety of criteria. In popular use (though not in the official specification), an XPath expression is often referred to simply as "an XPath".
Originally motivated by a desire to provide a common syntax and behavior model between XPointer and XSLT, subsets of the XPath query language are used in other W3C specifications such as XML Schema, XForms and the Internationalization Tag Set (ITS).
XPath has been adopted by a number of XML processing libraries and tools, many of which also offer CSS Selectors, another W3C standard, as a simpler alternative to XPath.
XPath 2.0 is a version of the XPath language defined by the World Wide Web Consortium, W3C. It became a recommendation on 23 January 2007. As a W3C Recommendation it was superseded by XPath 3.0 on 10 April 2014.
XPath is used primarily for selecting parts of an XML document. For this purpose the XML document is modelled as a tree of nodes. XPath allows nodes to be selected by means of a hierarchic navigation path through the document tree.
The language is significantly larger than its predecessor, XPath 1.0, and some of the basic concepts such as the data model and type system have changed. The two language versions are therefore described in separate articles.
XPath 2.0 is used as a sublanguage of XSLT 2.0, and it is also a subset of XQuery 1.0. All three languages share the same data model (the XDM), type system, and function library, and were developed together and published on the same day.
Every value in XPath 2.0 is a sequence of items. The items may be nodes or atomic values. An individual node or atomic value is considered to be a sequence of length one. Sequences may not be nested.
XPath 3 is the latest version of the XML Path Language, a query language for selecting nodes in XML documents. It supersedes XPath 1.0 and XPath 2.0.
XPath 3.0 became a W3C Recommendation on 8 April 2014, while XPath 3.1 became a W3C Candidate Recommendation on 18 December 2014.
Compared to XPath 2.0, XPath 3.0 adds the following new features:
XPath 3.1 mainly adds support for array and map (associative array) data types. These types and their associated functionality are intended to ease working with JSON data.
Another innovation is the arrow operator =>
for function chaining. For example the XPath 2.0 expression
can now be written
Tra me e te differenza già da come sei nato
io so' uscito de faccia, te er culo hai mostrato
hai continuato poi pe' tutta la vita
a servitte der culo come contropartita
Flaminio Maphia ma li mortacci tu'
pe' portà in giro 'sto nome nun so pazzo de più!
m'ha causato più problemi che a Clinton la Levinski
accusati a volte di esse' finti sui dischi
il fatto è, secco, che non leggi tra le righe
dove dico ora cosa faccio pe' vive
ti fermi all'apparenza, giudichi persone
che non conosci, questa è la differenza
quando ai tempi già ero nel racket
te tiravi ancora le seghe co' Postalmarket
io abituato a stare in trincea
mi scivoli addosso come sul cesso la diarrea
[chorus]Ne ho abbastanza
tra noi c'è differenza
spigni robba falsa
c'hai rotto er cazzo, cambia pietanza!
Non riesci a nascondere quello che tu sei
un camaleonte finto dipinto con lo spray
ti fai vedere con gli stracci addosso (zozzo)
ma c'hai la pellicceria all'ingrosso
sei un figlio di papà, inopportuno fai
il ragazzo di strada spingi fumo, ahi
un tipo senza mai soldi in tasca
ma si fa il bagno con i soldi nella vasca
parli male di me e non mi conosci, solo voci
continua, tanto non mi nuoci
perché prima o poi la tua storia traballa
e tutta la merda ti tornerà a galla!
[chorus]Ne ho abbastanza
tra noi c'è differenza
spigni robba falsa
c'hai rotto er cazzo, cambia pietanza!
Ad esempio mi critichi per la calza in testa
mentre macino testi pieni di consistenza
saranno cazzi mia e de come voglio vestì
tu giudica, stronzo, come faccio l'Mc
frizzi e lazzi mò beccate sti pazzi
non ne posso più di quei quattro pupazzi
te parlo anche con simpatia e furbizia
ma è sempre verità come Striscia la Notizia
tu stai tranquillo perché hai pronta la minestra
ma il mio frigo come il tuo micro ha tanta carenza
non ti piaccio, pazienza non comprà er CD
ma pensa a te stesso che è mejo così
hai una doppia vitaccia, doppia pellaccia
la differenza si nota guardandoti in faccia
la realtà esce fuori e mò sono guai
zero peli sulla lingua come Celentano in RAI
[chorus]Ne ho abbastanza
tra noi c'è differenza
spigni robba falsa