aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/mammoth/Mammoth.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/zwobble/mammoth/Mammoth.java')
-rw-r--r--src/main/java/org/zwobble/mammoth/Mammoth.java20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/main/java/org/zwobble/mammoth/Mammoth.java b/src/main/java/org/zwobble/mammoth/Mammoth.java
index de0c45e..e2408e9 100644
--- a/src/main/java/org/zwobble/mammoth/Mammoth.java
+++ b/src/main/java/org/zwobble/mammoth/Mammoth.java
@@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableMap;
import org.zwobble.mammoth.documents.*;
import org.zwobble.mammoth.docx.BodyXmlReader;
import org.zwobble.mammoth.docx.DocumentXmlReader;
+import org.zwobble.mammoth.docx.OfficeXml;
import org.zwobble.mammoth.docx.Styles;
import org.zwobble.mammoth.xml.XmlElement;
import org.zwobble.mammoth.xml.parsing.XmlParser;
@@ -19,23 +20,10 @@ import java.util.zip.ZipFile;
import static com.google.common.collect.Iterables.transform;
public class Mammoth {
- private static ImmutableBiMap<String, String> XML_NAMESPACES = ImmutableBiMap.<String, String>builder()
- .put("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main")
- .put("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing")
- .put("a", "http://schemas.openxmlformats.org/drawingml/2006/main")
- .put("pic", "http://schemas.openxmlformats.org/drawingml/2006/picture")
- .put("content-types", "http://schemas.openxmlformats.org/package/2006/content-types")
- .put("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships")
- .put("relationships", "http://schemas.openxmlformats.org/package/2006/relationships")
- .put("v", "urn:schemas-microsoft-com:vml")
- .put("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006")
- .put("office-word", "urn:schemas-microsoft-com:office:word")
- .build();
-
public static String convertToHtml(File file) {
try (ZipFile zipFile = new ZipFile(file)) {
ZipEntry entry = zipFile.getEntry("word/document.xml");
- XmlElement documentXml = parseXml(zipFile.getInputStream(entry));
+ XmlElement documentXml = OfficeXml.parseXml(zipFile.getInputStream(entry));
Styles styles = new Styles(ImmutableMap.of(), ImmutableMap.of());
Document document = new DocumentXmlReader(new BodyXmlReader(styles)).readElement(documentXml);
@@ -78,8 +66,4 @@ public class Mammoth {
}
});
}
-
- private static XmlElement parseXml(InputStream inputStream) {
- return new XmlParser(XML_NAMESPACES).parseStream(inputStream);
- }
}