var xml: XML = <root xmlns:space="http://www.something.com"> <space:tag> <node>Hello, world!</node> </space:tag> </root>; trace( xml.hasOwnProperty( "tag" ) );
In this case, hasOwnProperty() will return false as the 'tag' tag is part of the 'space' namespace. In order to overcome this, use the QName construct, e.g.:
xml.hasOwnProperty( new QName( "http://www.something.com", "tag" ) )
Alternatively, if you have declared a namespace previously, you can do the following:
namespace space = "http://www.something.com"; // ... xml.hasOwnProperty( new QName( space, "tag" ) )
No comments:
Post a Comment