aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/mammoth/docx/StylesXml.java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-02-24 08:16:16 +0000
committerMichael Williamson <mike@zwobble.org>2016-02-24 08:16:16 +0000
commit3e2786a004eddf968a5fa7d5a92dff5b1b5f7734 (patch)
tree7fa1bcc1e484cd0ef782f64baf504ee83333d397 /src/main/java/org/zwobble/mammoth/docx/StylesXml.java
parent0dc3a12affc2e46c1a0df2899cf51a1ae3fdbd61 (diff)
Create internal package
Diffstat (limited to 'src/main/java/org/zwobble/mammoth/docx/StylesXml.java')
-rw-r--r--src/main/java/org/zwobble/mammoth/docx/StylesXml.java33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/main/java/org/zwobble/mammoth/docx/StylesXml.java b/src/main/java/org/zwobble/mammoth/docx/StylesXml.java
deleted file mode 100644
index f7a955d..0000000
--- a/src/main/java/org/zwobble/mammoth/docx/StylesXml.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.zwobble.mammoth.docx;
-
-import org.zwobble.mammoth.documents.Style;
-import org.zwobble.mammoth.xml.XmlElement;
-import org.zwobble.mammoth.xml.XmlElementList;
-
-import java.util.Map;
-import java.util.Optional;
-
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Maps.immutableEntry;
-import static org.zwobble.mammoth.util.MammothMaps.toMap;
-
-public class StylesXml {
- public static Styles readStylesXmlElement(XmlElement element) {
- XmlElementList styleElements = element.findChildren("w:style");
- return new Styles(
- readStyles(styleElements, "paragraph"),
- readStyles(styleElements, "character"));
- }
-
- private static Map<String, Style> readStyles(XmlElementList styleElements, String styleType) {
- return toMap(
- filter(styleElements, styleElement -> styleElement.getAttribute("w:type").equals(styleType)),
- StylesXml::readStyle);
- }
-
- private static Map.Entry<String, Style> readStyle(XmlElement element) {
- String styleId = element.getAttribute("w:styleId");
- Optional<String> styleName = element.findChildOrEmpty("w:name").getAttributeOrNone("w:val");
- return immutableEntry(styleId, new Style(styleId, styleName));
- }
-}