在js文件中使用AJAX获取动态创建的XML值

I have created a dynamic xml file with php as follows

('Content-Type: text/xml');?>
<?php $newitem = $_GET["book"];
$action = $_GET["action"];
$qty=0;
$isbnVal="XYZ";
if ($_SESSION["Cart"] != ""){
 $MDA = $_SESSION["Cart"];
 if ($action == "Add"){
  if ($MDA[$newitem] != ""){  
  $tempValue = $MDA[$newitem];
  $value=$tempValue["qty"]+1;
  $MDA[$newitem] =array("qty" =>  $value,"isbn" => $isbnVal);
  }else{$MDA[$newitem] =array("qty" => 1,"isbn" => $isbnVal);}
  }else{$MDA= "";}
}
else{$MDA[$newitem] =array("qty" => 1,"isbn" => $isbnVal);}
$_SESSION["Cart"] = $MDA; 
ECHO (toXml($MDA));                                         
function toXml($MDA){
 $doc = new DomDocument('1.0');
 $cart = $doc->createElement('cart');
 $cart = $doc->appendChild($cart);
 foreach ($MDA as $a => $b){
  //echo "isbn".$b["isbn"];//echo "qty".$b["qty"];  $book = $doc->createElement('book');
 $book = $cart->appendChild($book);

 $title = $doc->createElement('title'); 
 $title = $book->appendChild($title);   
 $value = $doc->createTextNode($a);
 $value = $title->appendChild($value);


 $quantity = $doc->createElement('quantity');
 $quantity = $book->appendChild($quantity);

 $value2 = $doc->createTextNode($b["qty"]);
 $value2 = $quantity->appendChild($value2);

 $isbn = $doc->createElement('isbn');
 $isbn = $book->appendChild($isbn);
 $value3 = $doc->createTextNode($b["isbn"]);
 $value3 = $isbn->appendChild($value3);
 }

        $strXml = $doc->saveXML(); 
        return $strXml;
    }

then I'm calling these values in a javaScript file to display. I can get the first and last values from firstChild and lastChild. But I can't get whatever is in the middle. I tried it as follows.

spantag.innerHTML += " " +header[0].firstChild.textContent;
spantag.innerHTML += " " +header[0].getElementsByTagName('qty');
spantag.innerHTML += " " + header[0].lastChild.textContent + "  <a href='#' onclick='AddRemoveItem(\"Remove\");'>Remove Item</a> ";

only the second code is not working. Plz tell me what I did wrong.Thanx in advance.