我有一个示例 XML 文件,如下所示:
<audit>
<asset>
<user_Id>1</user_Id>
<username>admin</username>
<asset_id>1001</asset_id>
<vin_7>2217841</vin_7>
<make>xyz</make>
<model>x5</model>
<color>red</color>
<reg_no>1234</reg_no>
<note>null</note>
<geopoint>
<geo_lat>-6.23</geo_lat>
<geo_long>50.43</geo_long>
</geopoint>
<status>incomplete</status>
</asset>
<asset>
<user_Id>1</user_Id>
<username>admin</username>
<asset_id>1001</asset_id>
<vin_7>2227841</vin_7>
<make>abc</make>
<model>x4</model>
<color>blue</color>
<reg_no>unknown</reg_no>
<note>null</note>
<location>test street</location>
<geopoint>
<geo_lat>-6.33</geo_lat>
<geo_long>50.22</geo_long>
</geopoint>
<status>incomplete</status>
</asset>
</audit>
我想获取用户名 = 'admin' 的 'vin_7' 元素列表。使用 JavaScript 怎么能做到这一点?