Difference between XPath, XQuery and XPointer Difference between XPath, XQuery and XPointer xml xml

Difference between XPath, XQuery and XPointer


Wikipedia is a good place to start for questions like this. Generally, XPath is a language used to succinctly pinpoint exact XML nodes in a DOM. XQuery is a superset of XPath that also provides FLWOR syntax, which is SQL-like. Finally, XPointer includes XPath, but also provides a simpler position-based addressing scheme.

Of course, you can always read the W3C specs for full details.


Though the answer by Matthew gives a good first impression, there is a lot more to tell about the mentioned standards, and there are many more that are related. There is a nice article from the XML Holland user group magazine made available online, that tells a lot about the history of XQuery, and takes various of these standards into perspective. The first part is quite relevant here:

XQuery stands for XML Query Language. That already tells the essence. It is a language to select subsets and substructures from a large set of XML files. The result can be manipulated into something that is suitable to be used in, for example, a subsequent process, or to show in a web browser. XPath is used a lot in XQuery.

All XML standards have their own scope. I’ll name a few. XSLT is a language for transforming XML into some other format. XPointer is an extension of XPath to address nodes more accurately within XML fragments or even subparts of nodes. XLink is a standard to define relationships. XInclude is a standard to compose multiple pieces of XML into one using for instance XLink relationships. And XProc is a standard with which can be described how XML documents should be processed to get to a desired end result. It is expressed itself in XML, and describes the process step by step, also called XML Pipelines. Within XProc you use a.o. XQuery, XSLT, and XInclude languages (and thus indirectly XPath, XPointer and XLink as well) to express what needs to be done exactly within each step.

All these standards are tied together. They are related, and depend on each other. The overlap between some of the mentioned XML standards is summarized quite well in the next image that you can also find at W3Schools:

What is XPath

Full article can be found here: http://grtjn.blogspot.nl/2011/10/xquery-novelties-revisited.html

HTH!


Well, I think XQuery is something worth to be distinguished. XPath and XPointer are almost the same and are used for XML nodes selection. XQuery on the other hand is quite a big extension of XPath. For example it gives possibility of declaring custom functions. So it's more something like programming language, which works natively with XML. You can check out some samples here: embedding-xquery-in-java

Regards