Wednesday, September 23, 2015

XPath, XQuery and XPointer


Difference between XPath, XQuery and XPointer ?

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.
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.What is XPath

XQuery vs XPath
XQuery is a functional programming language that is used to query a group of XML data. It is able to manipulate and extract data from either XML documents or relational databases and MS Office documents that support an XML data source. It is a language that helps in creating syntax for new XML documents. XQuery is represented in the form of a tree model with seven nodes, namely processing instructions, elements, document nodes, attributes, namespaces, text nodes, and comments. All values are referred to as sequences. Even a single value is considered as a sequence of length one. The sequence can consist of either nodes or atomic values like integers, strings, or Booleans. It has the following features that are used for the transformation of XML data:
Side effect free.
Logical/physical data independence.
Strongly typed.
High level.
Declarative.
XPath is the XML Path Language that is used for selecting nodes from an XML document using queries. It can also compute values like strings, numbers, or Boolean type from another XML document. The expression in case of XML is known as XPath. It is represented as a tree structure with the ability of XPath to navigate it by selecting different nodes. It was created to define a common syntax and behavior model for XPointer and XSLT. XPath has the following features:
XPath defines the syntax for an XML document.
It has the capability to navigate path expressions in XML documents.
It has its own library defining standard functions.
It is a major component of XSLT.
Other differences between XPath and XQuery:
1. XPath is viewed as a regular expression whereas XQuery is like a C-programming language w.r.t. XML documents.
2. XPath is a filter for an XML dataset and is the transformational component of XSLT. XQuery is used to select several nodes from an XML document for the purpose of processing using different queries.
3. XQuery uses XPath syntax for addressing different parts of an XML document. The joins are performed using the FLWOR expression. This expression has five clauses, namely, WHERE, ORDER BY, FOR, LET, and RETURN.
Summary:
1. XPath is still in its nascent stage of development and as such is still a component of a query language.
2. XQuery supports XPath and extended relational models.
3. XQuery is a read-only language that is not very easy to formulate.
4. XQuery is not a standard and is difficult to optimize leading to poor performance.

No comments:

Post a Comment