Flash XML Object Layout Question

This is the XML map I need:


<main>
<chunk title="Title" subtitle="Subtitle" title_y="25" sub_y="70" bul_y="110">
<bullet xray="25" seen="1" cue="2">Bullet 1</bullet>
</chunk>
</main>

If I lay out this XML object in Flash:


function makeXML() {
 chunkXML1 = new XML();
 chunkXML1.contentType = "text/xml";
 
 chunkElement1 = chunkXML1.createElement("main");
 chunkElement2 = chunkXML1.createElement("chunk");
 chunkElement2.attributes.title = title;
 chunkElement2.attributes.subtitle = subtitle;
 chunkElement2.attributes.title_y = title_y;
 chunkElement2.attributes.sub_y = sub_y;
 chunkElement2.attributes.bul_y = bul_y;
 
 chunkElement3 = chunkXML1.createElement("bullet");
 chunkElement3.attributes.xray = xray1;
 chunkElement3.attributes.seen = seen1;
 chunkElement3.attributes.cue = cue1;
 
 chunkElement4 = chunkXML1.createTextNode(con1);
 
 chunkXML1.appendChild(chunkElement4);
 chunkXML1.appendChild(chunkElement3);
 chunkXML1.appendChild(chunkElement2);
 chunkXML1.appendChild(chunkElement1);
}

When I trace I get:


Bullet number 1<bullet cue="0" seen="1" xray="25" /><chunk bul_y="110" sub_y="70" title_y="25" subtitle="Subtitle" title="Title" /><main />

Where are the beginning brackets for each element and why are the attributes appearing in the second bracket?

Thank you