• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 9. Recursive Approach > Recursive Design

Recursive Design

The flaw here is obvious. The code works all right, but it is severely limited. It is hideously ugly code—far too redundant, too specific. There is too much code and ironically it does too little: we will only see the generations we have explicitly coded. This version goes down three generations from the root. Some XML will look fine. Some will show only a truncated picture of the data.

We can clean up the code by factoring all the display code into a function call. Note that we need to hook this function to the base XML object. This causes it to address the XML object's namespace. It shares this namespace with the onLoad function that will call it.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint