nfarina/xmldoc

react native using xmldoc to parser xml

leechance opened this issue · 3 comments

i want to use xmldoc to parse an in-memory XML string in my React-Native Project
in addtion,i have to 'npm install xmldoc' an the directory of my project.

in this case
`import React, { Component } from 'react';
import { AppRegistry, Text, View } from 'react-native';
class AwesomeProject extends Component {
render() {
this.testXml();
return (
<View style={{alignItems: 'center'}}>
浪费时间

);
}

testXml(){
// Demonstrate parsing an in-memory XML string
var xmldoc = require('xmldoc');
var xmlString = '';
}
}
AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);`

but caused an error

*Unable to resolve module stream from /Volumes/MAC/ReactNative/AwesomeProject/node_modules/sax/lib/sax.js: Unable to find this module in its module map or any of the node_modules directories under /Volumes/node_modules/stream and its parent directories
*

how to solve the issue ,can you help me?

Hm, it looks like React Native is not pulling in the sax dependency. I'll try to repro this and investigate.

thanks!!!
i have soloved the problem
if i want to use xmldoc to parse an in-memory XML , 'nmp install buffer' and 'npm install stream ' must be done first;

i8wu commented

omg thanks @leechance ...weird that it was complaining about sax and not buffer/stream.