Accessing data in xml through flash

for those of you who use xml in flash, let’s say you use the following xml document:

<main>
<titlebar>
<filename>something.jpg</filename>
<text>This is text in the titlebar</text>
</titlebar>
<body>
<filename>somethingelse.jpg</filename>
</body>
</main>

and you wanted to access the value in main/titlebar/text… how would you go about it? do you have to use the nextSibling command and a for loop to count down until you get to the one you want?