我使用Android中的Dom解析器来解析下面XML
<offerURL>
http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=553&BEFID=93767&aon=%5E1&MerchantID=434524&crawler_id=1909400&dealId=TCk4NTG97Aa3wSQgh2U3FQ%3D%3D&url=http%3A%2F%2Frover.ebay.com%2Frover%2F1%2F707-64686-24023-0%2F2%3Fipn%3Dpsmain%26icep_item_id%3D190622592957%26icep_vectorid%3D260601%26kwid%3D1%26mtid%3D637%26crlp%3D1_260601%26kw%3D%7Bquery%7D%26query%3D%7Bquery%7D%26linkin_id%3D%7Blinkin_id%7D%26sortbid%3D%7Bbidamount%7D%26fitem%3D190622592957%26mt_id%3D637&linkin_id=7000251&Issdt=120323134700&searchID=p2.77722a731149145f60fa&DealName=Samsung+B2100+Outdoor+In+Schwarz+%28black%29+Orig.+Neuware&dlprc=89.95&crn=&istrsmrc=1&isathrsl=0&AR=1&NG=3&NDP=6&PN=1&ST=7&DB=sdcprod&MT=phx-pkadu-intl-dc20&FPT=DSP&NDS=&NMS=&MRS=&PD=95929320&brnId=14863&IsFtr=0&IsSmart=0&DMT=&op=&CM=&DlLng=7&RR=1&cid=&semid1=&semid2=&IsLps=0&CC=0&SL=0&FS=1&code=&acode=538&category=&HasLink=&frameId=&ND=&MN=&PT=&prjID=&GR=&lnkId=&VK=
</offerURL>
使用的下面的代码解析:
Node node = .....
String nodeName = node.getNodeName();
if (nodeName.equalsIgnoreCase("offerURL")) {
String offerUrl = node.getFirstChild().getNodeValue()
Log.d("offerUrl => " + offerUrl);
}
运行没有出错,但是 tag的值被截断。变量 offerUrl 的值在 log cat中是 http://statTest.dealtime.com/DealFrame/DealFrame.cmp?bm=553
我不知道问题出现在哪,请求帮忙。