E4x expressions all return a valid XMLList object.

So xml.a, if it exists will have a non-zero length() (I can never
remember which length is a method and which is a property, so verify
that).

If it does not exist, then xml.a.length() == 0.

Relatedly, the syntax [EMAIL PROTECTED] will error if attrName is not an
attribute for all nodes being parsed.  The expression
xml.attribute("attrName") will not error if the attribute is missing,
since it returns an XMLList.  Treating that XMLList as text, it appears
as an empty string.  Not quite sure how that works.

Tracy

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Tom Chiverton
Sent: Thursday, November 29, 2007 6:12 AM
To: [email protected]
Subject: Re: [flexcoders] Re: How use hasOwnProperty() in combination
with namespace

On Thursday 29 Nov 2007, hannes.stockner wrote:
> Would you be so kind as to explain me the solution by my example.

Firstly, bookmark http://www.linkwerk.com/pub/javascript/e4x/e4x-tester/
as it 
lets you play with E4X expressions easily.

> I want to check if the property <a> exists.

Ignoring the namespace, the expression you want is just "xml.a" - either

you'll get back the node, or nothing.

-- 
Tom Chiverton
Helping to dynamically entrench ubiquitous designs
on: http://thefalken.livejournal.com

****************************************************

This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England
and Wales under registered number OC307980 whose registered office
address is at St James's Court Brown Street Manchester M2 2JF.  A list
of members is available for inspection at the registered office.  Any
reference to a partner in relation to Halliwells LLP means a member of
Halliwells LLP.  Regulated by The Solicitors Regulation Authority.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and
may be confidential or legally privileged.  If you are not the addressee
you must not read it and must not use any information contained in nor
copy it nor inform any person other than Halliwells LLP or the addressee
of its existence or contents.  If you have received this email in error
please delete it and notify Halliwells LLP IT Department on 0870 365
2500.

For more information about Halliwells LLP visit www.halliwells.com.


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links





Reply via email to