all files / model/ XMLImporter.js

20% Statements 1/5
100% Branches 0/0
50% Functions 1/2
20% Lines 1/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27                                                   
import { DefaultDOMElement } from '../dom'
import DOMImporter from './DOMImporter'
 
/*
  Base class for custom XML importers. If you want to use HTML as your
  exchange format see {@link model/HTMLImporter}.
 
  TODO: provide example and activate reenable API docs
*/
 
class XMLImporter extends DOMImporter {
 
  constructor(config, context) {
    super(Object.assign({ idAttribute: 'id' }, config), context)
  }
 
  importDocument(xml) {
    this.reset()
    let dom = DefaultDOMElement.parseXML(xml)
    this.convertDocument(dom)
    return this.state.doc
  }
 
}
 
export default XMLImporter