Problem with XML appending and AS3

Hi all,

Basically I have an XML file which will be used to populate a menuBar inside a flex application. Currently the format of the XML file is like so.

<mymenu>
<menuitem label=“File”>
<menuitem label=“New” />
<menuitem label=“Open” />
<menuitem label=“Close” />
</menuitem>

&lt;menuitem label="Edit"&gt;
		&lt;menuitem label="" /&gt;
&lt;/menuitem&gt;   
			
&lt;menuitem label="View"&gt;
	&lt;menuitem label="Zoom"/&gt;  
	&lt;menuitem label="Toolbars"/&gt; 
&lt;/menuitem&gt; 

</mymenu>

Currently, my format for reading the XML file is like so.
var xmlData = new XML(e.target.data); //e. is the event listener when the urlloader is completed.

var menuBarItems:XMLList = xmlData.menuitem;

for each (var menuItem:XML in menuBarItems) {
//Each loop will get a single menu including submenus
ex. <menuitem label=“File”>
<menuitem label=“New” />
<menuitem label=“Open” />
<menuitem label=“Close” />
</menuitem>
//Next loop will be the Edit
}

Problem is… I need to be able to edit the data for Edit. Because Edit should be just
<menuitem label=“Edit”>
</menuitem>

Because there are cases where the edit should be no submenus underneath it, Unfortunately when i change the xml file to this, the edit will not be read all together (inside the for loop since it does not contain any menuitem. i need to be able to edit it since its possible that i might need to add new childen as shown below). There are cases wherein i need to add new nodes inside the edit
for submenus
ex.
<menuitem label=“Edit”>
<menuitem label=“Edit 1”/>
<menuitem label=“Edit 2”/>
</menuitem>

How should I approach this? How should my XML file look like? I’m not really sure what to do since the appendchild would only work for lists contianing one item. but if i do have i blank item it would look like

<menuitem label=“Edit”>
<menuitem label=""/>
<menuitem label=“Edit 1”/>
</menuitem>

leaving a submenu blank and of no use.

Any help would be appreciated.