Skip to main content
100%

<title>Testing XPath

✓ Published0🌍 Public
CCliffordAnderson
Last edited Feb 6, 2014
Created on Jan 28, 2014

This example demonstrates how an XML TEI document’s structure can be queried using XPath and represented as an interactive node-link diagram. It displays the document’s hierarchical elements—such as `teiHeader`, `text`, `body`, and `p`—as circles connected by links, with text content visible alongside node labels. The visualization uses D3.js’s `d3.hierarchy` and `d3.tree` layout to calculate positions, while `d3.zoom` enables panning and zooming. The code loads the XML via a local file and parses it with `DOMParser`, then applies XPath expressions via `document.evaluate` to extract elements and text for rendering.

AI-generated description

Similar vizzes