All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zwobble.mammoth.internal.docx.DocumentXmlReader Maven / Gradle / Ivy

There is a newer version: 1.8.0
Show newest version
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 readElement(XmlElement element) {
        XmlElementLike body = element.findChildOrEmpty("w:body");
        return bodyReader.readElements(body.getChildren())
            .toResult()
            .map(children -> new Document(children, notes));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy