XPath
Navigate the XML tree with paths, predicates and functions.
What you will be able to do
- Use / for children and // for descendants.
- Use @ for attributes.
- Use predicates to filter.
- Use text() and functions such as count().
In plain English
XPath addresses nodes with paths such as /course/lessons/lesson. Predicates filter with [@minutes > 10], and axes such as ancestor and following-sibling move through the tree. XPath 1.0 and 2.0 differ; know which your tool supports.
/course/lessons/lesson[@minutes > 10]
//lesson[last()]
count(//lesson)Your turn
EasySelect a child
Write an XPath that selects title elements under course.
HTML · starter
/courseCheck your understanding before moving on.
Knowledge checkQuestion 1
What does // select?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.