questa sera lo provo, perche adesso devo uscire.
Dammi la tua opinione su una cosa se puoi:
Con il codice che mi hai dato genero un xml usando l'oggetto DOM.
E probabilmente é quello che useró.
Pero allo stesso tempo stavo pensando un'altra cosa: si potrebbe generare una string che semplicemente si formatta in modo xml?
una cosa tipo questa:

codice:
function get_model_props(model){
     //retreives "model" from db
     //lists out price material etc. 
     //and returns an xml string created from it
    var output="";
    return output;
}

function get_brand(brand){
     //retreives  all models from "brand" from db,
     var output="<brand name="+brand+">";
     for(i=0; i<total_models; i++){
          output+="<model>";
          get_model_props(models[i]);
          output+="</model>";
     }
     output+="</brand>";
     return output;
}

function get_brands(){
     //retreives all brands from database,
     //and loops through them
     var output="<products>";
     for(i=0;i<total_brands;i++){
          output+=get_brand(brands[i]);
     }
     output+="</products>";
     reuturn output;
}


my_xml=get_brands();

return my_xml;
Le funzioni sono indicative di una idea, ovvero creare una string che tiene la forma di un xml...
I nomi sono in inglese perché l'ho appena vista in un altro foro e mi chiedevo quale differenza ci sarebbe tra i due modi di lavorare.
Credo che usando DOM sia piú corretto, tu cosa ne pensi?