我有一个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