Model structured documents with elements, attributes, namespaces, schemas, parsing, and transformations.
Lessons
Move between parent, child, and sibling nodes.
DOM Navigation is easiest to learn by reading the example, changing it, and observing the result.
const doc = new DOMParser().parseFromString(xmlString, 'application/xml');
const root = doc.documentElement; // root element
const first = root.firstElementChild; // first child element
const lessons = doc.getElementsByTagName('lesson');
for (const lesson of lessons) {
console.log(lesson.getAttribute('level'),
lesson.querySelector('title').textContent);
}Practice the DOM Navigation example in a small scratch file, then explain what changed and why.