LLMpediaThe first transparent, open encyclopedia generated by LLMs

XPath

Generated by GPT-5-mini
Note: This article was automatically generated by a large language model (LLM) from purely parametric knowledge (no retrieval). It may contain inaccuracies or hallucinations. This encyclopedia is part of a research project currently under review.
Article Genealogy
Parent: CSS Hop 3
Expansion Funnel Raw 57 → Dedup 23 → NER 19 → Enqueued 12
1. Extracted57
2. After dedup23 (None)
3. After NER19 (None)
Rejected: 4 (not NE: 4)
4. Enqueued12 (None)
Similarity rejected: 4
XPath
NameXPath
ParadigmDeclarative, functional
DesignerWorld Wide Web Consortium
First appeared1999
Latest release3.1
Influenced byXML Path Language, XML
LicenseW3C Recommendation

XPath

XPath is a query and navigation language for selecting nodes from XML documents and related data representations. It is specified by the World Wide Web Consortium and is widely used alongside XSLT, XQuery, XForms, and XPointer in applications ranging from Web Services to Content Management Systems. XPath expressions operate over the Document Object Model and interoperates with implementations in languages such as Java (programming language), C#, Python (programming language), and JavaScript.

Overview

XPath provides a compact syntax to navigate hierarchical structures such as XML Schema-described documents, SOAP messages, and serialized HTML treated as XML. It defines a data model and an expression language that can extract node-sets, strings, numbers, and booleans used by XSLT 1.0, XSLT 2.0, XQuery 1.0, XForms 1.0, and later specifications. Implementations appear in libraries from vendors such as Apache Software Foundation (e.g., Apache Xerces), Microsoft, Oracle Corporation, and open-source projects like libxml2 and Saxon.

Syntax and Data Model

XPath expressions are built from location steps, predicates, and operators that target nodes in a tree conforming to the XPath Data Model (XDM). The XDM represents document nodes including element, attribute, text, comment, processing-instruction, and document nodes; it maps to constructs defined in XML Information Set and DOM Level 3 Core. Location paths use axes such as child, descendant, parent and attribute to traverse the tree; node tests filter by node kind or name often bound to a Namespace (computer science) via prefixes declared in an accompanying XML context such as an XML Namespace declaration. Atomic values in XDM include types influenced by XML Schema Part 2: Datatypes and the model supports sequences used by XQuery 1.1 and later.

Expressions and Operators

Expressions combine path expressions with boolean, numeric, and string operators standardized across W3C recommendations. Numeric behavior aligns with IEEE floating point norms adopted in many ISO/IEC specifications; string handling interoperates with Unicode as defined by Unicode Consortium standards. Comparison operators include equality and ordering that differ between node-set, sequence, and atomic comparisons; logical operators such as and and or are used in predicate filters alongside functions from the standard library. Operator precedence and expressive constructs enable transformation tasks similar to those carried out by XSLT 2.0, XQuery 3.0, and query engines embedded in Relational Database Management Systems and NoSQL processors.

Functions and Axes

XPath provides a standard library of functions for string processing, numeric computation, type conversion, date/time handling, and node-set manipulation adopted by XSLT and XQuery modules. Core axes include self, descendant, ancestor, following-sibling and namespace which mirror traversal semantics used in DOM Level 2 and DOM Level 3 Core APIs; axis semantics influence performance characteristics in processors such as Saxon and MSXML. Function libraries reference standards like XML Schema Part 2: Datatypes for casting and type promotion; additional extension functions are exposed by environments including .NET Framework, Oracle Database, IBM Db2, and libraries like libxml2 and Apache Xerces.

Implementations and Usage

XPath is implemented in a broad ecosystem: native parsers and processors provided by Mozilla, Google, Apple Inc., Microsoft integrate XPath into browsers and development frameworks; server-side engines include Saxon, Xalan, and vendor extensions in Oracle Database and SQL Server (Microsoft). It is used in automated testing tools such as Selenium (software) for locating elements in HTML, in configuration systems like Ant (software), and in interoperability layers for SOAP and RESTful services. Tooling and IDEs such as Eclipse (software), Visual Studio, and IntelliJ IDEA provide XPath evaluators and integration with XML editors and Continuous Integration pipelines.

History and Standards

XPath was first published as a W3C Recommendation in 1999 alongside XSLT 1.0 and later revised into XPath 2.0 and 3.0 to align with richer type systems from XML Schema and the XQuery language. Key milestone documents include W3C Recommendations and working drafts that reflect collaboration among organizations such as World Wide Web Consortium, Software AG, Oracle Corporation, Microsoft, and academic contributors. Subsequent versions addressed sequence types, higher-order functions, and integration with XQuery 3.1 features; industry adoption was driven by browser vendors, database suppliers, and XML toolkits used in standards-driven domains like OASIS and W3C technical workgroups.

Category:XML