The Top Level XML class actually has a function, called hasOwnProperty that
exists for this purpose.

However, to answer your question exactly, it returns a value of undefined.
This is not null or "" it is it's own return type, as this relates to XML
(which by definition is an object) and objects are dynamic. Null would only
be returned if you've already declared a variable but it has no value,
undefined is returned for something that you have not declared.

So in addition to Steven's method, you could also do:

if (node.hasOwnProperty("@instance"))

or

if (no...@instance != undefined)

- Taka

On Wed, Aug 26, 2009 at 6:06 PM, Steven Sacks <[email protected]>wrote:

> You will get runtime errors when attempting to access an attribute that
> isn't there.  The proper way to check for existence and length of an
> attribute is to use the .attributes() syntax as such:
>
> if (node.hasOwnProperty("instance").length() > 0)
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to