code: function(attributes) {
          var extendedData = this.createElementNS(this.kmlns, "ExtendedData");
          for (var attributeName in attributes) {
              // empty, name, description, styleUrl attributes ignored
              if (attributes[attributeName] && attributeName != "name" && attributeName != "description" && attributeName != "styleUrl") {
                  var data = this.createElementNS(this.kmlns, "Data");
                  data.setAttribute("name", attributeName);
                  var value = this.createElementNS(this.kmlns, "value");
                  if (typeof attributes[attributeName] == "object") {
                      // cater for object attributes with 'value' properties
                      // other object properties will output an empty node
                      if (attributes[attributeName].value) {
                          value.appendChild(this.createTextNode(attributes[attributeName].value));
                      }
                      if (attributes[attributeName].displayName) {
                          var displayName = this.createElementNS(this.kmlns, "displayName");
                          // displayName always written as CDATA
                          displayName.appendChild(this.getXMLDoc().createCDATASection(attributes[attributeName].displayName));
                          data.appendChild(displayName);
                      }
                  } else {
                      value.appendChild(this.createTextNode(attributes[attributeName]));
                  }
                  data.appendChild(value);
                  extendedData.appendChild(data);
              }
          }
          if (this.isSimpleContent(extendedData)) {
              return null;
          } else {
              return extendedData;
          }
      }
docs: Method: buildExtendedData
  
  Parameters:
  attributes - {Object}
  
  Returns
  {DOMElement} A KML ExtendedData node or {null} if no attributes.