我有一個javascript對象,我需要引用它的一個孩子的價值。孩子應該是數組的一部分。Javascript對象兒童參考?
這工作:
this.manager.response.highlighting[doc.id]['sentence_0002']
但這並不:
this.manager.response.highlighting[doc.id][0]
我不知道哪個sentence_000*
號碼將被退回,所以我想引用它通過它的陣列數。
this.manager.response.highlighting[doc.id].length
也不返回任何東西。
這裏是被闢爲JavaScript對象的XML文檔的一部分:
<response>
<lst name="highlighting">
<lst name="http://www.lemonde.fr/international/">
<arr name="sentence_0005">
<str> puni pour sa gestion de la crise Geir Haarde a été condamné pour avoir manqué aux devoirs de sa </str>
我需要連接在<str>
值。 doc.id
已成功設置爲http://www.lemonde.fr/international/
。
這將是表現出更多的有用從XML創建的JavaScript對象。 – RobG