Tool.Yun
Handige tools voor ontwikkelaars
Achtergrond van de afbeelding verwijderen
Afbeelding EXIF/Metadata/GPS/JPEG Kwaliteitslezer
Afbeelding bijsnijden
Afbeelding naar SVG (potrace)
Afbeelding vergelijken
Afbeeldingsformaat wijzigen
Afbeeldingskleuromvormer
Camera recorder
Converter voor afbeeldingsformaten
EXIF verwijderen
GIF naar MP4
HEIC-converter
ICO/PNG-converter
OCR-afbeelding en PDF
SVG-voorbeeldweergave
Watermerk
Base64 Hex-array-encoder/-decoder
Base64 bestandconversie
Base64 string encoder/decoder
Basis converter
Converter voor veel eenheden
Csv naar gegevens
Dataopslageenheid converter
E-mailnormalisator
Eigenschappen converter
Energieverbruik- en kostencomputer
Env-variabelen formaatconverter
Excel naar gegevens
Omrekenaar van geografische coรถrdinaten
Romeins cijfer omzetten
Tekst naar UTF-8 binair
Tekst naar Unicode
Torrent naar Magneet
ULID-generator
Unicode-tekens naar Java-entiteiten converter
dBm mW-converter
AGE Cryptografie
Ansible kluis crypt decoderen
Argon2 Hasher
Bcrypt
Bech32 Encoder/Decoder
Bestand Hasher
CRC-calculator
Certificaat-/sleutelparser
ECDSA-sleutelpaargenerator
Ed25519 sleutelpaargenerator
HMAC generator
Hash-tekst
JWT-generator
JWT-parser
Jasypt String Encryption
MVO-generator
Niceware Bytes naar wachtwoordzin
PGP-bestandsversleuteling
PGP-encryptie
PGP-sleutelgenerator
Paseto/PASERK Lokaal
Paseto/PASERK Publiek/Privรฉ
RSA-encryptie
RSA-sleutelpaar generator
RSA/DSA/ECDSA-ondertekenaar en verificateur
SAML-parser
SSL-certificaatconverter
Shamirs geheime delen
Versleutel / ontsleutel tekst
X509-certificaatgenerator
BMI-calculator
BTW-nummervalidator
Compatibiliteit van softwarelicenties
Creditcardcontrole
IBAN validator en parser
IES-verlichtingsrichtlijnen
ISBN-validator en -parser
ISO 3166 Landcodezoeker
ISO 639-zoeker
Kalenderomzetter
Leg het shellcommando uit
Looptempo calculator
Luhn Validator
Online woordenboek
RMB Hoofdletterconverter
SLA-calculator
Telefoon parser en formatter
Unicode-zoekopdracht
Valutacalculator
Aftellen
Chronometer
Cron/Weekdag Alarm
Dagencalculator
Datum+Duurcalculator
Datum/tijd-converter
Duurcalculator
ETA calculator
ICAL-bestandsparser
ICAL-generator
TTL-calculator
Tijdalarm
Tijdzone-omzetter
Weeknummers converter
Welke dag?
iCal-fusie
Docker Compose Validator
Docker Compose naar .env-bestand
Docker Compose naar Docker run converter
Docker Compose naar Quadlets
Docker Compose-formaatconverter
Docker Pangolin-labels
Docker compose naar Kubernetes
Docker inspecteren om Docker uit te voeren
Docker run naar Docker compose converter
Docker run naar Kubernetes
Docker-image-downloader
Docker-run naar Quadlets
Dockerfile Label Generator
Kubernetes RBAC-generator
Traefik Docker Compose Maker
Amortisatiecalculator
ActiveDirectory LDAP-eigenschappenzoeker
Bestandstypedetector
Bounce e-mailparser
Converter voor drijvende-kommagetallen
Cookies-parser
DMARC-rapportanalysator
DNS-propagatietester
DNS-tester
Dode pixeltester
E-mailparser
EMV TLV-decoder
ETH-transactiedecoder
GZip/Deflate-converter
Gevoelige gegevensmasker
HTTPS-tester
Hex-encoder/decoder
Keycode-informatie
Korte URL's Expander
MIME-coderingsconverter
Midden-Endiaanse converter
MongoDB ObjectId-converter
Nmap Command Builder
Outlook MSG-parser
Outlook Safelink-decoder
Parketbestandenlezer
RJ45 Cat6 bedradingsspiekbrief
SMART Raw Converter
Seriรซle poortconsole
Sharepoint Share URL Decoder
Sneeuwvlok-ID-extractor
TCPDump-generator
Tekstcharsetdetector/-decoder
URL parser
URL-builder
Weerstandscalculator
้”ฎ็›˜ๆต‹่ฏ•ๅ™จ
Dobbelsteenroller
Kaartkiezer
Muntengooier
Rad van fortuin
BIP39 wachtwoordgenerator
Diceware wachtwoordgenerator
Generator voor willekeurige getallen
NanoIDs-generator
Numeroniem generator
OTP-codegenerator
Pincodegenerator
Token generator
UUID-converter
UUID-generator
Wachtwoordzingenerator
Berichtenpakket naar JSON
CSV naar JSON
JS naar JSON-converter
JSON naar .env
JSON naar C#
JSON naar CSV
JSON naar JS-converter
JSON naar Java Entiteit
JSON naar MessagePack
JSON naar TOML
JSON naar TS
JSON naar XML
JSON naar YAML converter
JSON naar gegevens
JSON om bezwaar te maken
JSON om te gaan
JSON opmaken en formatteren
JSON verkleinen
JSON-afvlakker/ontvlakker
JSON-diff
JSON-editor
JSON-fusie
JSON-linter
JSON-sorteermaster
Jq/JSONPath-tester
Json Escaper/Unescaper
Json naar PHP-Array
Json naar PHP-code
Json naar Python
Json naar SQL DDL
Json naar schema
Json-grootte-analysator
Json-query
Json-stringconverter
ObjGen naar JSON
PHP-Array naar JSON
tools.json-patch.name
Epub naar Markdown
HTML naar markdown
Markdown Lorem Ipsum
Markdown naar DOCX
Markdown naar HTML
Markdown naar data
Markdown naar tekst
Markdown-editor
Markdown-inhoudsopgavegenerator
Markdown-tabelgenerator
Markdown-tabelprettiger
Markdown-verschil
Markdown-voorbeeld
Plakken als Markdown
tools.markdown-format-converter.name
Beeldverhoudingcalculator
Benchmark-builder
Geo-afstandscalculator
Percentage calculator
Acceleratieomvormer
Drukeenheden converter
Energie-eenheden converter
Fitnesscomputer
Frequentieomzetter
Hoekeenheden converter
Kracht-eenheden converter
Lengte-eenheden converter
Massa-eenheden converter
Oppervlakte-eenheden converter
SI-voorvoegselomzetter
Snelheidsomzetter
Temperatuurconverter
Verlichtingssterkteconverter
Vermogenomvormer
Voedsel-energieomzetter
Volume-eenheden converter
Volumestroomomzetter
ARPA-decoder
Apache LogRotate Generator
BIMI DNS-generator
Basis-auth generator
Calculator voor het uitsluiten van IP-subnetten
Chmod calculator
Cloudflare DNS/RDAP-query's
Crontab generator
Curl Command Generator
DKIM DNS-generator
DMARC DNS-generator
DNS-query's
DNSBL-controleur
FStab-generator
Gegevensoverdrachtssnelheidcalculator
Gehele getallen naar IPv4/IPv6
Generator voor afsluitopdrachten
HAS-ontsmettingsmiddel
HDD-calculator
HTAccess-generator
Htpasswd/htaccess-generator
IP-geografische locatie
IPv4 subnetcalculator
IPv4-6/IPRange/CIDR in IP-bereik/CIDR/IP-masker
IPv4-adresconverter
IPv4-bereik uitbreider
IPv4-subnetlister
IPv4/6-bereik naar CIDR(s)-calculator
IPv6 ULA-generator
IPv6-adresconverter
IPv6-subnetcalculator
Iptables-generator
Ipv4/6 CIDR naar IP-bereikcalculator
MAC-adres generator
MAC-adres opzoeken
MAC-adresconverter
Microfoontester
Mijn IP-adres
Multilink-downloader
Nginx-formatter
Optie43 generator
PTR DNS-generator
Ping
Poortnummers
Punycode-converter
RAID-betrouwbaarheidscalculator
RAID-calculator
Rsync-generator
SIP-autorisatie
SPF DNS-generator
Shell-opdrachten formatteren
Shell-opdrachten linearisator
TCP/UDP-poorttester
UFW-commandogenerator
Visuele subnetcalculator
WPA PSK-generator
Wachtwoord sterkte-analyse
Websocket-testen
Whois-controle
Willekeurige poortgenerator
Wireguard-configuratiegenerator
X-VR-SpamCause Decoder
ZPOOL RAID-calculator
ZPool Spiekbriefje
Zxcvbn Wachtwoordsterkte
firewalld opdrachtregelgenerator
tools.restic-command-generator.name
tools.url-redirection-checker.name
ANSI Escape Tester
API-tests
Bestandssplitter
CSS/JS Opmaak & Minimalisatie
Cli-opdracht-editor
Code/Scripts Markeerstift
Database tabelgenerator
Database-creatiebuilder
Databaseverbindingsreeksbouwer
Django Secret Generator
Favicon-generator
Gegevensvervalser
GitIgnore-generator
Gitattributengenerator
HEX-bestandsconverter
Javascript Obfuscator
Javascript Prettifier
Javascript Unobfuscator/Unpacker
Json naar Protobuf
Json naar SQL INSERT
Json naar Typescript
K6 Load Testing Script Generator
Krulconverter
Mailto-generator
Offerte Converter
Open graph meta generator
Picomatch-tester
Pomodoro-timer
SQL opmaken en formatteren
SQL-minifier
SQL-parametergenerator
Stacktrace mooier
String Escaper
Swagger UI-tester
HTML naar PDF
PDF decoderen en ontgrendelen
PDF versleutelen
PDF-compressor
PDF-handtekening checker
PDF-pagina-extractor
PDF-tekstextractor
Pdf Lineariseren/FastWeb
Pdf-concatener
Algemene Regex-spiekbrief
Bash Spiekbriefje
CSS-selectors-spiekbriefje
Docker Compose-spiekbriefje
Docker SWARM-spiekbriefje
Docker-spiekbriefje
Dockerfile-spiekbriefje
Git Semantische Commit Spiekbriefje
Git cheatsheet
JSONPath-syntaxis-spiekbriefje
Jq Spiekbriefje
K8s Spiekbriefje
Markdown-spiekbriefje
Nano Spiekbriefje
Nginx Spiekbriefje
PowerShell-spiekbrief
Regex-spiekbriefje
Sed-spiekbriefje
Spiekbrief voor Zellij-commando's
Spiekbriefje voor Tmux-opdrachten
Spiekbriefje voor schermopdrachten
VIM-spiekbriefje
XPath-syntaxis-spiekbriefje
chmod Commando Spiekbriefje
Cron-expressiebouwer
Barcodegenerator
Barcodelezer
GTIN-validator
QR-code generator
QR-codedecoder
QR-contactgegevensgenerator
WiFi QR-code generator
tools.epc-qrcode-generator.name
TOML Linter
TOML naar JSON
TOML naar YAML
AI Prompt Splitter
ASCII-kunsttekstgenerator
Afbeelding naar ASCII Art
Bestanden inpakken voor AI
Citatiegenerator
Dubbele regelszoeker
Emoji keuze
GPT-token-encoder/-decoder
GPT-tokenschatter
Hoofdletter-omzetter
I en L-controleur
JSON naar TOON
Lettertype vergelijken
Levenshtein-rekenmachine
Lijstconverter
Lijsten vergelijken
Lorem ipsum generator
Mapstructuurdiagram
Morsecode-omzetter
RSVP-lezer
Regex-tester
Rune-converter
Sed Command-generator
Slimme tekstvervanger en regelafbreking
Sociale linkdeler
String obfuscator
TOON naar JSON
Tab naar Spaces
Tekst naar NAVO-alfabet
Tekst naar Unicode-namen
Tekst uit HTML halen
Tekst-diff
Tekststatistieken
Tekstvertaler
Toetsenbordindeling converter
Unicode naar GSM-7
Unicode-formatter
Verschillende woorden
Willekeurige regelkiezer
Zalgo Generator/Banner
Zeemeermin exporteur
Afbeelding naar CSS
Apparaat-informatie
CSS XPath-converter
CSS-eenhedenconverter
CSS-verloopgenerator
Css-prettiger
HTML WYSIWYG-editor
HTML naar XHTML
HTML naar data
HTML-entiteiten
HTML-minifier
HTML-prettiger
HTML-reiniger
HTTP-statuscodes
Kleurcontrastcontrole
Kleurconverter
Kleurenwiel
MIME-types
REM Pixelconverter
SVG placeholder generator
Slugify string
URL-catcher
URL-encoder
URL-reiniger
UTM-URL-generator
Url Tekst Zoeken Fragment Maker
User-agent parser
Binaire rekenmachine
Converter voor wiskundige formaten
Fooiencalculator
Trigonometrische/vergelijkingscurve-visualisator
Wiskunde evaluator
Wiskundige OCR
ObjGen naar HTML
XML formatter
XML naar JSON
XML-linter
XPath-tester
XSLT-tester
YAML naar JSON converter
YAML naar TOML
YAML opmaken en formatteren
YAML-afvlakker/ontvlakker
YAML-fusie

XPath-syntaxis-spiekbriefje

XPath-syntaxis-spiekbriefje

XPath navigates an XML or HTML document as a tree. Every step has the form axis::node-test[predicate], and most of it has a short form: //div[@class="card"]/a/@href reads โ€œthe href of every a inside any div with class cardโ€.

โš ๏ธ Browsers, Selenium and most scrapers implement XPath 1.0. ends-with(), matches(), lower-case() and replace() are 2.0+ and only work in tools like xmllint, Saxon or lxml with an XSLT 2.0 processor. Workarounds for 1.0 are given below.

๐Ÿงญ Path Syntax

XPathSelects
/From the document root โ€” an absolute path
//Anywhere in the document, at any depth
.The current (context) node
..The parent of the context node
@attrAn attribute
*Any element
@*Any attribute
text()The text nodes of an element
node()Any node at all, text and comments included
[n]The nth match โ€” 1-based, not 0-based
[last()]The last match
a | bThe union of two expressions
/html/body            (: absolute: the body of the page :)
//text()              (: every text node :)
./div/b               (: relative to the context node :)
(//p)[2]              (: the second p in the whole document :)
//p[2]                (: every p that is the second p of its parent :)

๐Ÿท Elements & Attributes

XPathDescriptionCSS
//EEvery <E> elementE
(//E)[2]The second <E> in the documentโ€”
//E[@A]<E> carrying attribute AE[A]
//E[@A="t"]<E> where A is exactly tE[A='t']
//E[contains(@A,"t")]<E> where A contains tE[A*='t']
//E[starts-with(@A,"t")]<E> where A starts with tE[A^='t']
//E[substring(@A, string-length(@A)-2)="t"]<E> where A ends with t (1.0 trick)E[A$='t']
//E[ends-with(@A,"t")]The same, XPath 2.0+ onlyE[A$='t']
//E[matches(@A,"r")]A matches regex r (2.0+)โ€”
//E/@AThe value of attribute Aโ€”
//*/@AAttribute A of any elementโ€”
//E[@A2="t"]/@A1A1 where A2 is tโ€”
//E1[@id="I1"] | //E2[@id="I2"]Either elementE1#I1, E2#I2
//E[@id="I1" or @id="I2"]<E> with either idE#I1, E#I2

๐Ÿ†” Id, Name, Class & Language

XPathDescriptionCSS
//*[@id="I"]The element with id I#I
//E[@id="I"]<E> with id IE#I
//*[@name="N"]Any element named N[name='N']
//*[@name="N"][@value="v"]Named N with value v[name='N'][value='v']
//*[contains(concat(" ", normalize-space(@class), " "), " C ")]Element with class C โ€” the padding avoids matching C2.C
//E[contains(concat(" ", normalize-space(@class), " "), " C ")]<E> with class CE.C
//E[@lang="L" or starts-with(@lang, concat("L","-"))]<E> in language L or a subcodeE[lang|='L']

๐Ÿ“ Text & Links

XPathDescriptionCSS
//*[.="t"]Element whose whole text is exactly tโ€”
//E[contains(text(),"t")]<E> with a text node containing tโ€”
//E[contains(.,"t")]<E> whose text, descendants included, contains tโ€”
//E[normalize-space()="t"]Exact text, ignoring surrounding whitespaceโ€”
//aEvery linka
//a[.="t"]The link labelled exactly tโ€”
//a[@href="url"]The link pointing at urla[href='url']
//a[.="t"]/@hrefThe URL behind the label tโ€”
//a[starts-with(@href,"https")]Secure links onlya[href^='https']

๐Ÿ‘ช Parents & Children

XPathDescriptionCSS
//E/*[1]First child of <E>E > *:first-child
//E/*[last()]Last child of <E>E > *:last-child
//E[1]Each <E> that is the first of its type in its parentE:first-of-type
//E[last()]Last <E> of its typeE:last-of-type
//E[2]Second <E> of its typeE:nth-of-type(2)
//*[2][name()="E"]Second child, if it is an <E>E:nth-child(2)
//E[last()-1]Second-to-last <E> of its typeE:nth-last-of-type(2)
//E/..The parent of <E>โ€”
//div/form/parent::*Every element that has a form childdiv:has(> form)
//*[@id="I"]//E<E> anywhere under id I#I E
//E[count(*)=0]<E> with no element childrenE:empty
//E[count(*)=1]<E> with exactly one childโ€”
//E[count(preceding-sibling::*)+count(following-sibling::*)=0]<E> that is an only childE:only-child
//E[count(../E)=1]<E> with no <E> siblingsE:only-of-type
//E1[E2 and not(*[not(self::E2)])]<E1> whose only children are <E2>โ€”
//E[position() mod N = M + 1]Every Nth element, offset by ME:nth-child(Nn+M)

๐Ÿ‘ฅ Siblings

XPathDescriptionCSS
//E2/following-sibling::E1Every <E1> after a sibling <E2>E2 ~ E1
//E2/following-sibling::*[1][name()="E1"]<E1> immediately after <E2>E2 + E1
//E2/following-sibling::*[2][name()="E1"]<E1> two siblings after <E2>E2 + * + E1
//E/following-sibling::*[1]Whatever follows <E> directlyE + *
//E2/preceding-sibling::E1Every <E1> before a sibling <E2>โ€”
//E2/preceding-sibling::*[1][name()="E1"]<E1> immediately before <E2>โ€”
//E/preceding-sibling::*[1]Whatever precedes <E> directlyโ€”

๐Ÿ“Š Tables & Form State

XPathDescriptionCSS
//*[@id="T"]//tr[3]//td[2]Third row, second cell#T tr:nth-child(3) td:nth-child(2)
//td[preceding-sibling::td="t"]The cell right after the one reading tโ€”
//td[preceding-sibling::td[contains(.,"t")]]Cells following one containing ttd:has(~ td)
//table[count(tr)=1 and count(tr/td)=2]Tables with one row and two columnsโ€”
//table/tr[last()]The last row of a tabletable tr:last-child
//E[@disabled]A disabled controlE:disabled
//E[not(@disabled)]A control that is not disabledE:enabled
//*[@checked]A checked checkbox or radio:checked

๐Ÿงฎ Functions

Strings

FunctionReturns
contains(haystack, needle)True when the first string contains the second
starts-with(haystack, needle)True when it starts with it
concat(s1, s2, โ€ฆ)The strings joined together
normalize-space(s)The string with runs of whitespace collapsed and trimmed
string-length(s)The number of characters
substring(s, start [, length])A slice โ€” 1-based
substring-before(haystack, needle)Everything before the first occurrence
substring-after(haystack, needle)Everything after it
translate(s, from, to)Characters mapped one by one โ€” the 1.0 way to fold case

Numbers, logic & nodes

FunctionReturns
count(node-set)How many nodes matched
sum(node-set)The sum of their numeric values
position()The index of the context node within its step
last()The size of the context โ€” so [last()] is the final node
name([node-set])The qualified name of the first node
namespace-uri([node-set])Its namespace URI
lang(s)True when the node is in that language
not(expr)The negation
true() / false()Boolean constants
boolean(expr) / string(o) / number(o)Type conversions
ceiling(n) / floor(n) / round(n)Rounding

๐Ÿ’ก Case-insensitive matching in XPath 1.0: //E[contains(translate(@A,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz"), "t")]

๐Ÿงญ Axes

AxisShort formSelects
child(default)The direct children of the context node
descendant//Every node below the context node
descendant-or-self//The context node and everything below it
parent..The single parent node
ancestorโ€”Parent, grandparent, up to the root
ancestor-or-selfโ€”The same, including the context node
followingโ€”Everything after the node in document order, except descendants
following-siblingโ€”Later siblings under the same parent
precedingโ€”Everything before it, except its ancestors
preceding-siblingโ€”Earlier siblings under the same parent
attribute@The attributes of the node
self.The context node itself
//td[.="Total"]/ancestor::table          (: the table a cell belongs to :)
//h2[.="Specs"]/following-sibling::ul[1] (: the list after a heading :)
//input[@name="q"]/ancestor-or-self::form (: the form wrapping a field :)

๐Ÿง  Worked Examples

//hr[@class="edge" and position()=1]
(: the first hr of class 'edge' under each parent :)

//table[parent::div[@class="pad"] and not(@id)]//a
(: links in unnamed tables inside a padded div :)

/html/body/div/*[preceding-sibling::h4]
(: whatever comes after an h4 :)

//tr/td[font[@class="head" and text()="TRACK"]]
(: cells whose font child says TRACK :)

//*[count(*)=3]
(: elements with exactly three children :)

//rdf:Seq/rdf:li/em:id
(: namespaced elements โ€” the prefixes must be bound by the host tool :)

//var | //acronym
(: a union of two node sets :)

๐Ÿ›  Running XPath

// browser devtools console
$x('//a[contains(@href, "docs")]');

// plain DOM API
document.evaluate('//h1', document, null, XPathResult.ANY_TYPE, null).iterateNext();
# from the shell, over XML or HTML
xmllint --xpath '//book/title/text()' catalog.xml
xmllint --html --xpath '//a/@href' page.html 2>/dev/null
from lxml import html
tree = html.parse('page.html')
tree.xpath('//div[@class="card"]/a/@href')
# Selenium and Playwright both accept XPath locators
driver.find_element(By.XPATH, '//button[normalize-space()="Save"]')
page.locator('xpath=//button[normalize-space()="Save"]').click()

โš ๏ธ Notes

  • Indexes start at 1. [0] never matches anything.
  • //E[1] is per-parent, (//E)[1] is document-wide โ€” the single most common XPath bug.
  • Namespaced documents need prefixes registered with the host library; in XPath 1.0 a common workaround is //*[local-name()="title"].
  • // is expensive on large documents; anchor the path when you can.
  • Prefer text matching with normalize-space() โ€” HTML is full of stray whitespace and line breaks.

๐Ÿ“š Resources

  • MDN โ€” XPath
  • MDN โ€” XPath functions
  • XPath 1.0 specification
  • XPath cheat sheet (alephzarro)

Credit to the original author: https://gist.github.com/jmaccabee/550a0b9fcfdc7e6b170cd34c6ec7bc56