UNPKG

hy_excelize

Version:

买菜用。感谢:https://github.com/zurmokeeper/excelize.git

61 lines (50 loc) 1.5 kB
const BaseXform = require('../base-xform'); const XdrPicXform = require('./xdr-pic-xform'); class EtcCellImageXform extends BaseXform { constructor() { super(); this.map = { 'xdr:pic': new XdrPicXform(), }; } render(xmlStream, model) { xmlStream.openNode('etc:cellImage'); this.map['xdr:pic'].render(xmlStream, model); xmlStream.closeNode(); } parseOpen(node) { if (this.parser) { this.parser.parseOpen(node); return true; } switch (node.name) { case 'etc:cellImage': this.model = {}; return true; default: this.parser = this.map[node.name]; if (this.parser) { this.parser.parseOpen(node); return true; } throw new Error(`Unexpected xml node in parseOpen: ${JSON.stringify(node)}`); } } parseText() {} parseClose(name) { if (this.parser) { if (!this.parser.parseClose(name)) { this.model = this.parser.model; this.parser = undefined; } return true; } switch (name) { case 'etc:cellImage': return false; default: throw new Error(`Unexpected xml node in parseClose: ${name}`); } } } module.exports = EtcCellImageXform;