# Easier way to target an XML element

**URL:** <https://forum.kirupa.com/t/easier-way-to-target-an-xml-element/332122>\
**Category:** flash\
**Created:** [February 7, 2014, 12:11pm UTC](https://forum.kirupa.com/t/easier-way-to-target-an-xml-element/332122 "2014-02-07T12:11:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aidanmack](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@aidanmack](https://forum.kirupa.com/u/aidanmack)\
**Post date:** [February 7, 2014, 12:11pm UTC](https://forum.kirupa.com/t/easier-way-to-target-an-xml-element/332122/1 "2014-02-07T12:11:15Z")

</div>

Hi, Im using a for statment to run through the “event” items in the below xml. If I was looking for the event that’s time was “morning” I would create an if statment in the for statment to look for it.

Is their an easier way than that? can i get the event that’s time is set to morning directly?

Or am i doing it correctly using a for with an if statement init.

Thanks  
Aidan

```auto

[COLOR=#000000][FONT=monospace]<events>[/FONT][/COLOR]
[COLOR=#000000][FONT=monospace]<event time="morning">
<stuff>some stuff about morning</stuff>

</event>

<event time="afternoon">
<stuff>some stuff about afternoon</stuff>

</event>

<event time="evening">
<stuff>some stuff about evening</stuff>

</event>

[/FONT][/COLOR]
[COLOR=#000000][FONT=monospace]</events>[/FONT][/COLOR]

```
