XML DOM Traversing - XML DOM

What is XML DOM Traversing?

The DOM object that is parsed is traversed. The process by which looping is done in a systematic manner is known as Traversing and is done by going across each and every element in node tree step by step.

Example

The illustration demonstrates DOM traversing. Each child node of <Employee> element is traversed.

  • The code is loaded by node.xml
  • The XML content is transformed into JavaScript XML DOM object.
  • Using getElementsByTagName() method, the array of elements is obtained.
  • Through this array the traverse is done and the child node value is displayed in the table.

Execution

The file is saved as traverse_example.html on the server path and the output received appears as follows:

XML DOM Traversing

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

XML DOM Topics