All new
alle new
This commit is contained in:
1 parent
da64472251
commit
5b20adee48
1605 files changed
+396517
-1674
No files matched your search
+30
@@ -0,0 +1,30 @@
|
||||
exports.DocumentXmlReader = DocumentXmlReader;
|
||||
|
||||
var documents = require("../documents");
|
||||
var Result = require("../results").Result;
|
||||
|
||||
|
||||
function DocumentXmlReader(options) {
|
||||
var bodyReader = options.bodyReader;
|
||||
|
||||
function convertXmlToDocument(element) {
|
||||
var body = element.first("w:body");
|
||||
|
||||
if (body == null) {
|
||||
throw new Error("Could not find the body element: are you sure this is a docx file?");
|
||||
}
|
||||
|
||||
var result = bodyReader.readXmlElements(body.children)
|
||||
.map(function(children) {
|
||||
return new documents.Document(children, {
|
||||
notes: options.notes,
|
||||
comments: options.comments
|
||||
});
|
||||
});
|
||||
return new Result(result.value, result.messages);
|
||||
}
|
||||
|
||||
return {
|
||||
convertXmlToDocument: convertXmlToDocument
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user