blob: ca8c3dc9332c8bb63b6ba23356087d97a5dd77aa (
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
|
package org.zwobble.mammoth.internal.docx;
import org.zwobble.mammoth.internal.documents.Document;
import org.zwobble.mammoth.internal.documents.Notes;
import org.zwobble.mammoth.internal.results.InternalResult;
import org.zwobble.mammoth.internal.xml.XmlElement;
import org.zwobble.mammoth.internal.xml.XmlElementLike;
public class DocumentXmlReader {
private final BodyXmlReader bodyReader;
private final Notes notes;
public DocumentXmlReader(BodyXmlReader bodyReader, Notes notes) {
this.bodyReader = bodyReader;
this.notes = notes;
}
public InternalResult<Document> readElement(XmlElement element) {
XmlElementLike body = element.findChildOrEmpty("w:body");
return bodyReader.readElements(body.getChildren())
.toResult()
.map(children -> new Document(children, notes));
}
}
|