2009-09-17 4 views

답변

1

신경 쓰지 마시고 Ecma-357 standard, 특히 XML.prototype. * 및 XMLList.prototype. * 섹션 13.4 및 13.5를 통해 답변을 찾았습니다.

js>x = <a attr1='33' ><item>gumball!</item></a> 
<a attr1="33"> 
    <item>gumball!</item> 
</a> 
js>[email protected] 
33 
js>x.hasOwnProperty('@attr1'); 
true 
js>x.hasOwnProperty('@attr2'); 
false 
js>x.hasOwnProperty('item'); 
true 
js>x.hasOwnProperty('mongoose'); 
false 
0

쉬운 방법 : 아이디 attrtibute이 존재하고, 그렇지 않은 경우는 false 경우

(@attr1 in theXML) 

이 true를 돌려줍니다

그것은 hasOwnProperty() 방법입니다.