org.zwobble.mammoth.internal.docx.DocumentXmlReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mammoth Show documentation
Show all versions of mammoth Show documentation
Convert Word documents to simple and clean HTML
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