memostack
React Native XML 파싱
Mobile/React Native 2020. 7. 3. 21:07

xml2js 추가 xml 파싱을 위하여 xml2js 라이브러리를 추가한다. $ yarn add xml2js 사용 import {parseString} from 'xml2js'; parseString를 사용하기 위해 import를 한다. const url = ""; fetch(url) .then((response) => response.text()) .then((responseText) => { parseString(responseText, (err, result) => { if (err !== null) { console.log('Fail get data.'); } else { console.log(result); } }); }) .catch((error) => { console.log('Error fe..