Questions tagged [xpointer]

XPointer uses XPath expressions to navigate an XML document to target XLink hyperlinks at specific parts of an XML document.

XPointer is divided among four specifications: a framework which forms the basis for identifying fragments, a positional element addressing scheme, a scheme for namespaces, and a scheme for XPath-based addressing. XPointer Framework is a recommendation since March 2003.

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.

Positional Element Addressing

The element() scheme 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:

<foobar id="foo">
  <bar/>
  <baz>
    <bom a="1"/>
  </baz>
  <bom a="2"/>
</foobar>

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))

External links

28 questions
8
votes
3 answers

How to use xpointer with Xinclude to reference elements

I want to merge 2 XML files with the same structure to make one. For example; Test1.xml
Nerdio
  • 983
  • 2
  • 11
  • 18
6
votes
2 answers

Java library supporting XPointer with the xpointer() scheme?

Is there any java library supporting XPointer with the xpointer() scheme? Xerces supports XInclude with the XPointer Framework and the XPointer element() scheme, but not with the xpointer() scheme. The latest W3C document about the xpointer() schema…
Ulrik
  • 392
  • 1
  • 13
5
votes
1 answer

Using Python ElementTree/ElementInclude and xpointer to access included XML files

I have a 'main.xml' file that includes 2 'sub_x.xml' file. The include lines are using 'xpointer' to only point/include specific tags of the include xml's. When I use ElementTree to determine if this worked correctly, it shows that the whole 'sub'…
GKontos
  • 95
  • 1
  • 9
4
votes
2 answers

How to select all links on a page using XPath

I want to write a function that identifies all the links on a particular HTML page. My idea was to use XPath, by using a path such as //body//a[x] and incrementing x to go through the first, second, third link on the page. Whilst trying this out in…
njp
  • 695
  • 2
  • 8
  • 21
3
votes
1 answer

Using XLink to refer to nodes within same document

The general gist of a simple XLink to another node in the same document seems to be: ... Without using XPointer or XPath, is this as…
Gavin
  • 9,855
  • 7
  • 49
  • 61
3
votes
1 answer

XPath - select all elements except element (and it's subelements) with given attribute

I'm using xinclude to include some parts of document in another document, for example, in my main document I have:
jdex
  • 1,279
  • 1
  • 13
  • 20
3
votes
1 answer

XPointer URL not resolved when addressing apostrophe-encased @id values

Frustrating issue with XInclude / XPointer here. The aim is to include entries from a list of XML-formatted price-entries into another document. I have a document with a list of prices that looks like this:
marcoliver
  • 55
  • 4
3
votes
2 answers

XPointers in SVG

I've been trying to get XPointer URIs working in an SVG file, but haven't had any luck so far. After trying something more complicated and failing, I simplified it down to just referencing an ID. However, this still fails. The spec seems pretty…
Nycto
  • 1,670
  • 2
  • 14
  • 18
3
votes
1 answer

XML referencing to an id with # or not?

My current project consists of letters which are in collections. Each collection has an id and the letters refer to these ids. Coming from the "TEI world", I thought it would be the best solution to do that with #:
cis
  • 1,259
  • 15
  • 48
2
votes
1 answer

XLink & XPointer in real world app

Do you know some real examples of implementation and real use of extended XLink and XPointer? Does extended XLink or XPointer have some data model - can it be somehow a part of the DOM? Are there some standard approaches (libraries) how to process…
Daniel
  • 113
  • 2
  • 11
2
votes
1 answer

XML with recursive XInclude statements

I have a problem with a recursive XInclude statement. I have a main file where an XInclude exists on another file. In the included file are further XInclude statements. I parse my XML file with python and the library lxml. As a result I…
Görgen
  • 77
  • 5
2
votes
0 answers

XML signature: Verify that all required elements have been signed

I'm implementing the verification of an XML signature. In the (I wish it was more) technical document I'm using there's a distinction between (1) a verification as to whether all required elements of the message (which is specified with an xpointer…
Johan Maes
  • 1,161
  • 13
  • 13
2
votes
1 answer

Trying to use XInclude with Java and resolving the fragment with xml:id

I've been trying to get XInclude working in my XML document and finally have it working in Oxygen XML, which I'm using to author the XML documents. I then went to my app, written in Java, but it doesn't seem to support any form of XPointer…
Paul Hunnisett
  • 898
  • 1
  • 17
  • 36
2
votes
0 answers

Including only child elements in Log4J2 configuration with Xinclude

I would like to write a standard configuration file for log4j2 and extend it for special cases(test environments,modules, etc).Which would allow me to make a change in the main configuration file without repeating it in a alternative configuration…
alan7678
  • 2,223
  • 17
  • 29
2
votes
1 answer

Use/include a value from another node

I have an XML file, like this: value ????? I want to…
Kamafeather
  • 8,663
  • 14
  • 69
  • 99
1
2