Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

I've done a lot of the front end track but still no idea what Xpath is? (is there a course that covers it?)

I keep seeing Xpath mentioned everywhere but I still have no idea what it is. So far on the front end I've done

HTML deep dive CSS Basics Javascript basics, JS loops, JQuery Build an interactive Website AJax (in progress) Website Optimisation/Chrome Dev tools (in progress)

Is there a course that covers this as I'm still in the dark?

Thanks

2 Answers

XPath is a language for retrieving information from XML documents, just like how SQL is used to to retrieve data from databases. So XPath is only useful when you have an XML file and want to find some information in it.

XPath is implemented in JavaScript (and other languages as well). For example:

var xmlFile = getXMLFile('tree.xml');

/* Query string to get the first branch node in the XML file. */
var xPathString = 'root/trunk/branch[0]';

/* Search the XML file. */
var xpe = new XPathEvaluator();
var result = xpe.evaluate(xPathString, xmlFile, null, XPathResult.ANY_TYPE, null);

Here are some more resources:

Thanks for the info and the resources that's a great help. ( I like the SQL analogy).

I've been working as a front-end developer for a few years and I'd never even heard of Xpath. It is definitely not something you need to know, just another piece of functionality available to you.

https://developer.mozilla.org/en-US/docs/Web/XPath

Thanks that's very good to know particularly with your experience. I've seen it mentioned with regard to web scraping a lot and I've seen in Chrome dev tools and mentioned in a few other places. Good to know I wasn't necessarily missing out on a huge area that was potentially important.