skeleton code to parse XML. Still need:

1) a way to determine this is your team's format of xml
2) an algorithm to convert xml nodes to metamaps objects
3) define interface (maybe just Metamaps.Import.handleXML from javascript console for now)
This commit is contained in:
Devin Howard 2017-08-21 08:35:55 -07:00
parent 3482e799fd
commit b87482cb48
3 changed files with 25 additions and 1 deletions

View file

@ -70,6 +70,11 @@ const Import = {
Import.handle(results)
},
handleXML: function(text) {
const results = XMLParser.parseSchema(text)
Import.handle(results)
},
handle: function(results) {
var self = Import
var topics = results.topics.map(topic => self.normalizeKeys(topic))

View file

@ -0,0 +1,18 @@
import parseXML from 'xml-parser'
const XMLParser = {
parseSchema = (text) => {
// see format of data at https://www.npmjs.com/package/xml-parser
const data = parseXML(text)
// TODO algorithm to transform `data` to `returnValue`
// TODO this is the output format, but we still need to fill it in with real data
const returnValue = {
topics: [],
synapses: []
}
}
}
export default XMLParser

View file

@ -52,7 +52,8 @@
"riek": "1.0.7",
"simplewebrtc": "2.2.2",
"socket.io": "1.3.7",
"webpack": "2.2.1"
"webpack": "2.2.1",
"xml-parser": "^1.2.1"
},
"devDependencies": {
"babel-eslint": "^7.1.1",