我正在尝试访问 xml 响应对象中的元素,但我得到了 Uncaught Error: SYNTAX_ERR: DOM Exception 12
这是xml:
<ASIInventory request="01/28/2013 08:01" excute="366">
<Inventory SKU="102040">
<ItemId>920-002478</ItemId>
<Description>
<![CDATA[
Logitech Keyboard 920-002478 Desktop K120 USB Black Retail
]]>
</Description>
<Vendor>Logitech</Vendor>
<Category>KB</Category>
<SubCategory>98</SubCategory>
<UPC>097855065537</UPC>
<Price>11.00</Price>
<Rebate>
<![CDATA[ none ]]>
</Rebate>
<Term>none</Term>
<Weight>1.63</Weight>
<Status>ACTIVE</Status>
<Qty>
<Branch Code="1016" Name="Fremont">44</Branch>
<Branch Code="1028" Name="Los Angeles">121</Branch>
<Branch Code="1116" Name="Atlanta">47</Branch>
<Branch Code="1216" Name="Chicago">37</Branch>
<Branch Code="1316" Name="Dallas">23</Branch>
<Branch Code="1516" Name="Kansas">0</Branch>
<Branch Code="1716" Name="New Jersey">3</Branch>
<Branch Code="2416" Name="Miami">0</Branch>
<Branch Code="2616" Name="Portland">0</Branch>
</Qty>
</Inventory>
</ASIInventory>
这是我的浏览器脚本代码:
$(document).ready(function(){
$.ajax({
url: 'some.xml',
dataType: "xml",
success: function(xml) {
var test = $(xml).find('Vendor').text();
alert(test);
}
});
});
});