0
작은 코드를 작성하여 jQuery에서 XML을 구문 분석하지만 한 가지 문자 만 정보 속성에서 읽습니다.XML 구문 분석 - jQuery
는 XML :
는<series srss="29">
<srs info="2300,Sheffield Shield 2014-15"/>
<srs info="2313,Ram Slam T20 Challenge 2014-15"/>
<srs info="2275,Pakistan vs New Zealand in UAE, 2014"/>
<srs info="2293,England tour of Sri Lanka, 2014"/>
<srs info="2310,Ranji Trophy, 2014-15"/>
<srs info="2278,India tour of Australia, 2014-15"/>
<srs info="2262,West Indies in South Africa, 2014-15"/>
<srs info="2302,Big Bash League 2014-15"/>
<srs info="2291,Sri Lanka tour of New Zealand, 2014-15"/>
<srs info="2279,India and England in Australia Tri-Series, 2015"/>
<srs info="2292,Pakistan tour of New Zealand, 2015"/>
<srs info="2325,WC Warm up matches, 2015"/>
<srs info="2223,WC 2015"/>
<srs info="2307,Irani Cup, 2015"/>
<srs info="2321,County Championship Division One 2015"/>
<srs info="2322,County Championship Division Two 2015"/>
<srs info="2320,England tour of West Indies, 2015"/>
<srs info="2323,NatWest t20 Blast, 2015"/>
<srs info="2284,New Zealand tour of England, 2015"/>
<srs info="2280,India tour of Bangladesh, 2015"/>
<srs info="2285,The Ashes, 2015"/>
<srs info="2324,Royal London One-Day Cup, 2015"/>
<srs info="2286,Australia tour of Ireland, 2015"/>
<srs info="2287,Australia tour of England, 2015"/>
<srs info="2281,T20 WC League, 2015"/>
<srs info="2282,South Africa tour of India, 2015"/>
<srs info="2283,Sri Lanka tour of India, 2015-16"/>
<srs info="2317,England tour of South Africa, 2015-16"/>
<srs info="2263,T20 WC 2016"/>
</series>
코드 :
var i=0;
seriesArray = $(text).find('srs').attr('info'); //Returns 2300,Sheffield Shield 2014-15
//console.log(seriesArray);
var SeriesVal = $(text).find('srs').each(function(){
//console.log(this);
seriesArray[i] = $(this).attr('info'); //Returns 2 in first iteration, 3 in second iteration and so on
//console.log("Value = "+seriesArray[i]);
i=i+1;
});
이 붙어되고, 너무 정말 뭔가 작은 수 있습니다. 누군가 도와 줄 수 있어요. 미리 감사드립니다.