blob: fe6c7f12b3307e580456a7855bffb30e3d492a31 (
plain)
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
|
var readXmlFromZipFile = require("./office-xml-reader").readXmlFromZipFile;
exports.readRelationshipsFromZipFile = readRelationshipsFromZipFile;
function readRelationshipsFromZipFile(file) {
return readXmlFromZipFile(file, "word/_rels/document.xml.rels")
.then(function(relationshipsXml) {
return relationshipsXml ? readRelationships(relationshipsXml) : {};
});
}
function readRelationships(relationshipsXml) {
var relationships = {};
relationshipsXml.root.children.forEach(function(child) {
if (child.name === "{http://schemas.openxmlformats.org/package/2006/relationships}:Relationship") {
relationships[child.attributes.Id] = {
target: child.attributes.Target
};
}
});
return relationships;
}
|