XPointer

Revision as of 23:40, 12 January 2025 by imported>Sammi Brie (Importing Wikidata short description: "System for addressing components of XML-based Internet media")
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Template:Short description Template:Infobox technology standard

XPointer is a system for addressing components of XML-based Internet media. It is divided among four specifications: a "framework" that forms the basis for identifying XML fragments, a positional element addressing scheme, a scheme for namespaces, and a scheme for XPath-based addressing. XPointer Framework is a W3C recommendation since March 2003.<ref name="W3C-xptr-framework" /><ref name="timelinehistory">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

The XPointer language is designed to address structural aspects of XML, including text content and other information objects created as a result of parsing the document. Thus, it could be used to point to a section of a document highlighted by a user through a mouse drag action.

During development, and until 2016, XPointer was covered by a royalty-free technology patent held by Sun Microsystems.<ref name="patents">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

Positional element addressingEdit

The element() scheme<ref name="xpointer-element-scheme">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> introduces positional addressing of child elements. This is similar to a simple XPath address, but subsequent steps can only be numbers representing the position of a descendant relative to its branch on the tree.

For instance, given the following fragment:

<syntaxhighlight lang="xml"> <foobar id="foo">

 <bar/>
 <baz>
   <bom a="1"/>
 </baz>
 <bom a="2"/>

</foobar> </syntaxhighlight>

results as the following examples:

 xpointer(id("foo")) => foobar
 xpointer(/foobar/1) => bar
 xpointer(//bom) => bom (a=1), bom (a=2)
 element(/1/2/1) => bom (a=1) (/1 descend into first element (foobar),
                               /2 descend into second child element (baz),
                               /1 select first child element (bom))

See alsoEdit

ReferencesEdit

Template:Reflist

External linksEdit

Template:W3C Standards Template:Authority control