ActionScript: Check if a xml attribute/element exists 检查XML属性/元素是否存在

Categories: Flex; Tagged with: ; @ January 14th, 2012 0:21

Here is the XML:

<XeSex sexIDElement='MID'> <SexID> M </SexID> <Name> Male </Name> <Active> y </Active> <Code> M </Code> </XeSex>

Attitude:  sexIDElement = ‘MID’;
Element: Name = Male

trace(xmlTest.hasOwnProperty('@sexIDElement')); // check if the attribute exists trace(xmlTest.hasOwnProperty('Name')); // check if the element exists

BTW, About: XML Elements vs. Attributes

<->



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.