View Single Post
  #3 (permalink)  
Old March 31st, 2013, 05:50 PM
davidceline davidceline is offline
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default xml.tagName is undefined

I had the same problem running the example in Chapter 4 (peek.html)
I was connecting to googletalk servers.
I discovered that googeltalk sends back a space character on a regular basis, and the first one was sent before connection. This caused pretty_xml function to choke because the xml passed to the function did not have a tagName property.

I fixed it by checking for the tagName property, and just returning if it did not exist:
Code:
    	if (typeof(xml.tagName) == 'undefined' ) {
    		return "";
    	}