The reason why this always returns true is because 'text()' returns an
XMLList. In your setup you would want to check if the length of the XMLList
is 0 or not. For more detail check out: (
http://nondocs.blogspot.com/2007/05/toplevelxmltraversing-xml-structures.html
)
- Dan Freiman
On 9/12/07, jer_ela <[EMAIL PROTECTED]> wrote:
>
> this should work
>
> if (node.ItemSource.(hasOwnProperty("Media"))
>
> --- In [email protected] <flexcoders%40yahoogroups.com>, "kc7cia"
> <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > I was hoping someone could tell me how to check to see if an XML
> > element exists in AS3. I have an XML structure that looks like this:
> >
> > <ItemSource component="DAM">
> > <Value>Candy</Value>
> > <Media caption="Glucose Meter">10-372.gif</Media>
> > </ItemSource>
> >
> > I want to be able to check to see if the ItemSource element has a
> > Media subelement. The following code does not appear to work:
> >
> > if (node.ItemSource.Media.text() != null)
> > Alert.show('media');
> > else
> > Alert.show('no Media');
> >
> > It always returns true, regardless of whether or not there is a Media
> > subelement. Any help would be appreciated. Thanks!
> >
>
>
>