Appending, setting attributes, text to an XML DOM Object

Appending, setting attributes, text to an XML DOM Object

I am having an issue appending, setting attributes, text on the root node. Below is a sample of the code that performs this task (nLevel, nID, and sText are variables passed in by the containing function. XMLDOM is an XML DOMDocument object:
 
var oAna = $(oData).find('ana');
if(!$(oAna).length){
       // Create new 'ana' element
       oAna = $(XMLDOM.createElement('ana'));
       $(oData).append(oAna);
}




 
// Set attributes and text
$(oAna).attr({'level':nLevel, 'id':nID});
$(oAna).text(sText);


oData is an existing DOM element root node (<head>). The object already contains the follow XML:
 
<head mode="0" name="Demographics" title="Demographics">
      <dems>
             <dem level="1" id="1">Functional Area</dem>
      </dems>
</head>



 
The purpose of the code is to determine if element <ana> exists. If not, create this element and append it to the root node. Then set attributes and text on this node. The final XML should look at follows:
 
<head mode="0" name="Demographics" title="Demographics">
      <dems>
             <dem level="1" id="1">Functional Area</dem>
       </dems>


       <ana level="0" id="0">Analysis Area</ana>
</head>
 
This is a properly constructed XML document which I have validated.
 
This code works perfectly with IE, however with FF I can create and append <ana>, however I am unable to set attributes and text on <ana>. A similar set of code is used to create the initial XML document shown first.
 
Where am I messing up?