mirror of
https://github.com/mwilliamson/mammoth.js.git
synced 2024-12-08 15:14:29 +00:00
24 lines
669 B
JavaScript
24 lines
669 B
JavaScript
exports.DocumentXmlReader = DocumentXmlReader;
|
|
|
|
var documents = require("../documents");
|
|
var Result = require("../results").Result;
|
|
|
|
|
|
function DocumentXmlReader(options) {
|
|
var bodyReader = options.bodyReader;
|
|
|
|
function convertXmlToDocument(documentXml) {
|
|
var body = documentXml.root.first("w:body");
|
|
|
|
var result = bodyReader.readXmlElements(body.children)
|
|
.map(function(children) {
|
|
return new documents.Document(children, {notes: options.notes});
|
|
});
|
|
return new Result(result.value, result.messages);
|
|
}
|
|
|
|
return {
|
|
convertXmlToDocument: convertXmlToDocument
|
|
};
|
|
}
|