Creating Hierarchical Trees for HTML Files

In Hour 2, there was a correspondence between the HTML <span> tags and the data in the XML files. Given this relationship, it's possible to construct hierarchical trees to represent the structure of the HTML file. The HTML code from Listing 2.2 is reproduced in Listing 3.4, and the corresponding hierarchical tree is shown in Figure 3.4.

Listing 3.4 A Simple HTML Listing Needed as an Example to Convert into the Corresponding Tree Structure
 1: <html> 2: <head> 3: <title> An HTML used as an example to demonstrate the corresponding tree</title> 4: <script language=JavaScript> 5: … 6: </script> 7: </head> 8: <body bgcolor="ffffff" onLoad="StartUp()"> 9: TO:&nbsp;<span id=todata></span><br> 10: FROM:&nbsp;<span ...

Get Sams Teach Yourself XML in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.