var XMLBuilder = {
  quote: function(value)
  {
    return '"'+(value ? (value+"").replace(/"/gm,"&quot;") : '')+'"';
  },
  
  attribute: function(name, value)
  {
    return name+"="+XMLBuilder.quote(value);
  },
  
  openTag: function(name, attributes)
  {
    var xml = "<"+name+" ";
    var xmlAttributes = new Array();
    
    for(var i in attributes)
    {
			if ( typeof attributes[i] != "function" )
			{
			  xmlAttributes.push(XMLBuilder.attribute(i, attributes[i]));
			}
    }
    xml += xmlAttributes.join(" ");
    xml += ">";
    return xml;
  },
  
  closeTag: function(name)
  {
    return "</"+name+">";
  }
}