Take a look inside xmlsec command line utility: apps/xmlsec.c It has an option "--node-xpath" that does exactly what you need. Just follow the code to find out the c code that does it. Aleksey