From 03035ed09af320b45ac65796fd34a9202792c862 Mon Sep 17 00:00:00 2001 From: Sergey Vladimirov Date: Mon, 4 Jul 2011 19:14:44 +0000 Subject: [PATCH] rename extractor -> converter and move to converter package git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1142767 13f79535-47bb-0310-9956-ffa450edef68 --- .../AbstractWordConverter.java} | 6 ++-- .../AbstractWordUtils.java | 2 +- .../FoDocumentFacade.java | 2 +- .../HtmlDocumentFacade.java | 2 +- .../NumberFormatter.java | 33 +++++++++++-------- .../WordToFoConverter.java} | 25 +++++++------- .../WordToFoUtils.java | 2 +- .../WordToHtmlConverter.java} | 32 ++++++++++-------- .../WordToHtmlUtils.java | 2 +- .../TestWordToConverterSuite.java} | 12 +++---- .../TestWordToFoConverter.java} | 26 +++++++-------- .../TestWordToHtmlConverter.java} | 12 +++---- 12 files changed, 83 insertions(+), 73 deletions(-) rename src/scratchpad/src/org/apache/poi/hwpf/{extractor/AbstractWordExtractor.java => converter/AbstractWordConverter.java} (98%) rename src/scratchpad/src/org/apache/poi/hwpf/{extractor => converter}/AbstractWordUtils.java (99%) rename src/scratchpad/src/org/apache/poi/hwpf/{extractor => converter}/FoDocumentFacade.java (99%) rename src/scratchpad/src/org/apache/poi/hwpf/{extractor => converter}/HtmlDocumentFacade.java (98%) rename src/scratchpad/src/org/apache/poi/hwpf/{extractor => converter}/NumberFormatter.java (69%) rename src/scratchpad/src/org/apache/poi/hwpf/{extractor/WordToFoExtractor.java => converter/WordToFoConverter.java} (96%) rename src/scratchpad/src/org/apache/poi/hwpf/{extractor => converter}/WordToFoUtils.java (99%) rename src/scratchpad/src/org/apache/poi/hwpf/{extractor/WordToHtmlExtractor.java => converter/WordToHtmlConverter.java} (94%) rename src/scratchpad/src/org/apache/poi/hwpf/{extractor => converter}/WordToHtmlUtils.java (99%) rename src/scratchpad/testcases/org/apache/poi/hwpf/{extractor/TestWordToExtractorSuite.java => converter/TestWordToConverterSuite.java} (91%) rename src/scratchpad/testcases/org/apache/poi/hwpf/{extractor/TestWordToFoExtractor.java => converter/TestWordToFoConverter.java} (90%) rename src/scratchpad/testcases/org/apache/poi/hwpf/{extractor/TestWordToHtmlExtractor.java => converter/TestWordToHtmlConverter.java} (90%) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/extractor/AbstractWordExtractor.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java similarity index 98% rename from src/scratchpad/src/org/apache/poi/hwpf/extractor/AbstractWordExtractor.java rename to src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java index f13d9a1f6c..e047d3f564 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/extractor/AbstractWordExtractor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ -package org.apache.poi.hwpf.extractor; +package org.apache.poi.hwpf.converter; import java.util.HashMap; import java.util.List; @@ -38,7 +38,7 @@ import org.apache.poi.util.POILogger; import org.w3c.dom.Document; import org.w3c.dom.Element; -public abstract class AbstractWordExtractor +public abstract class AbstractWordConverter { private static final byte BEL_MARK = 7; @@ -49,7 +49,7 @@ public abstract class AbstractWordExtractor private static final byte FIELD_SEPARATOR_MARK = 20; private static final POILogger logger = POILogFactory - .getLogger( AbstractWordExtractor.class ); + .getLogger( AbstractWordConverter.class ); public abstract Document getDocument(); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/extractor/AbstractWordUtils.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordUtils.java similarity index 99% rename from src/scratchpad/src/org/apache/poi/hwpf/extractor/AbstractWordUtils.java rename to src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordUtils.java index 89849c15eb..9bbbf73e3a 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/extractor/AbstractWordUtils.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordUtils.java @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ -package org.apache.poi.hwpf.extractor; +package org.apache.poi.hwpf.converter; import java.io.Closeable; import java.io.File; diff --git a/src/scratchpad/src/org/apache/poi/hwpf/extractor/FoDocumentFacade.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/FoDocumentFacade.java similarity index 99% rename from src/scratchpad/src/org/apache/poi/hwpf/extractor/FoDocumentFacade.java rename to src/scratchpad/src/org/apache/poi/hwpf/converter/FoDocumentFacade.java index 5e474bf254..8a944a9ee9 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/extractor/FoDocumentFacade.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/FoDocumentFacade.java @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ -package org.apache.poi.hwpf.extractor; +package org.apache.poi.hwpf.converter; import org.w3c.dom.Document; import org.w3c.dom.Element; diff --git a/src/scratchpad/src/org/apache/poi/hwpf/extractor/HtmlDocumentFacade.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/HtmlDocumentFacade.java similarity index 98% rename from src/scratchpad/src/org/apache/poi/hwpf/extractor/HtmlDocumentFacade.java rename to src/scratchpad/src/org/apache/poi/hwpf/converter/HtmlDocumentFacade.java index 5e2b1f0166..506ba6d539 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/extractor/HtmlDocumentFacade.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/HtmlDocumentFacade.java @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ -package org.apache.poi.hwpf.extractor; +package org.apache.poi.hwpf.converter; import org.w3c.dom.Document; import org.w3c.dom.Element; diff --git a/src/scratchpad/src/org/apache/poi/hwpf/extractor/NumberFormatter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/NumberFormatter.java similarity index 69% rename from src/scratchpad/src/org/apache/poi/hwpf/extractor/NumberFormatter.java rename to src/scratchpad/src/org/apache/poi/hwpf/converter/NumberFormatter.java index d4a2cc726b..9897cfb0c1 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/extractor/NumberFormatter.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/NumberFormatter.java @@ -17,24 +17,27 @@ * ==================================================================== */ -package org.apache.poi.hwpf.extractor; +package org.apache.poi.hwpf.converter; /** * Comment me - * + * * @author Ryan Ackley */ -public final class NumberFormatter { +public final class NumberFormatter +{ - private static String[] C_LETTERS = new String[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", - "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "x", "y", "z" }; + private static String[] C_LETTERS = new String[] { "a", "b", "c", "d", "e", + "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", + "s", "t", "u", "v", "x", "y", "z" }; - private static String[] C_ROMAN = new String[] { "i", "ii", "iii", "iv", "v", "vi", "vii", - "viii", "ix", "x", "xi", "xii", "xiii", "xiv", "xv", "xvi", "xvii", "xviii", "xix", - "xx", "xxi", "xxii", "xxiii", "xxiv", "xxv", "xxvi", "xxvii", "xxviii", "xxix", "xxx", - "xxxi", "xxxii", "xxxiii", "xxxiv", "xxxv", "xxxvi", "xxxvii", "xxxvii", "xxxviii", - "xxxix", "xl", "xli", "xlii", "xliii", "xliv", "xlv", "xlvi", "xlvii", "xlviii", - "xlix", "l" }; + private static String[] C_ROMAN = new String[] { "i", "ii", "iii", "iv", + "v", "vi", "vii", "viii", "ix", "x", "xi", "xii", "xiii", "xiv", + "xv", "xvi", "xvii", "xviii", "xix", "xx", "xxi", "xxii", "xxiii", + "xxiv", "xxv", "xxvi", "xxvii", "xxviii", "xxix", "xxx", "xxxi", + "xxxii", "xxxiii", "xxxiv", "xxxv", "xxxvi", "xxxvii", "xxxvii", + "xxxviii", "xxxix", "xl", "xli", "xlii", "xliii", "xliv", "xlv", + "xlvi", "xlvii", "xlviii", "xlix", "l" }; private final static int T_ARABIC = 0; private final static int T_LOWER_LETTER = 4; @@ -43,8 +46,10 @@ public final class NumberFormatter { private final static int T_UPPER_LETTER = 3; private final static int T_UPPER_ROMAN = 1; - public static String getNumber(int num, int style) { - switch (style) { + public static String getNumber( int num, int style ) + { + switch ( style ) + { case T_UPPER_ROMAN: return C_ROMAN[num - 1].toUpperCase(); case T_LOWER_ROMAN: @@ -56,7 +61,7 @@ public final class NumberFormatter { case T_ARABIC: case T_ORDINAL: default: - return String.valueOf(num); + return String.valueOf( num ); } } } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordToFoExtractor.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java similarity index 96% rename from src/scratchpad/src/org/apache/poi/hwpf/extractor/WordToFoExtractor.java rename to src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java index 67f6bb17d1..5744a7b7ef 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordToFoExtractor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoConverter.java @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ -package org.apache.poi.hwpf.extractor; +package org.apache.poi.hwpf.converter; import java.io.File; import java.io.FileWriter; @@ -54,7 +54,7 @@ import org.w3c.dom.Text; /** * @author Sergey Vladimirov (vlsergey {at} gmail {dot} com) */ -public class WordToFoExtractor extends AbstractWordExtractor +public class WordToFoConverter extends AbstractWordConverter { /** @@ -80,7 +80,7 @@ public class WordToFoExtractor extends AbstractWordExtractor } private static final POILogger logger = POILogFactory - .getLogger( WordToFoExtractor.class ); + .getLogger( WordToFoConverter.class ); public static String getBorderType( BorderCode borderCode ) { @@ -132,21 +132,20 @@ public class WordToFoExtractor extends AbstractWordExtractor } /** - * Java main() interface to interact with WordToFoExtractor + * Java main() interface to interact with {@link WordToFoConverter} * *

- * Usage: WordToFoExtractor infile outfile + * Usage: WordToFoConverter infile outfile *

* Where infile is an input .doc file ( Word 97-2007) which will be rendered * as XSL-FO into outfile - * */ public static void main( String[] args ) { if ( args.length < 2 ) { System.err - .println( "Usage: WordToFoExtractor " ); + .println( "Usage: WordToFoConverter " ); return; } @@ -154,7 +153,7 @@ public class WordToFoExtractor extends AbstractWordExtractor System.out.println( "Saving output to " + args[1] ); try { - Document doc = WordToFoExtractor.process( new File( args[0] ) ); + Document doc = WordToFoConverter.process( new File( args[0] ) ); FileWriter out = new FileWriter( args[1] ); DOMSource domSource = new DOMSource( doc ); @@ -176,11 +175,11 @@ public class WordToFoExtractor extends AbstractWordExtractor static Document process( File docFile ) throws Exception { final HWPFDocumentCore hwpfDocument = WordToFoUtils.loadDoc( docFile ); - WordToFoExtractor wordToFoExtractor = new WordToFoExtractor( + WordToFoConverter wordToFoConverter = new WordToFoConverter( DocumentBuilderFactory.newInstance().newDocumentBuilder() .newDocument() ); - wordToFoExtractor.processDocument( hwpfDocument ); - return wordToFoExtractor.getDocument(); + wordToFoConverter.processDocument( hwpfDocument ); + return wordToFoConverter.getDocument(); } private final Stack blocksProperies = new Stack(); @@ -188,14 +187,14 @@ public class WordToFoExtractor extends AbstractWordExtractor protected final FoDocumentFacade foDocumentFacade; /** - * Creates new instance of {@link WordToFoExtractor}. Can be used for output + * Creates new instance of {@link WordToFoConverter}. Can be used for output * several {@link HWPFDocument}s into single FO document. * * @param document * XML DOM Document used as XSL FO document. Shall support * namespaces */ - public WordToFoExtractor( Document document ) + public WordToFoConverter( Document document ) { this.foDocumentFacade = new FoDocumentFacade( document ); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordToFoUtils.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoUtils.java similarity index 99% rename from src/scratchpad/src/org/apache/poi/hwpf/extractor/WordToFoUtils.java rename to src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoUtils.java index 1b3447f006..65953708eb 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordToFoUtils.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToFoUtils.java @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ -package org.apache.poi.hwpf.extractor; +package org.apache.poi.hwpf.converter; import org.apache.poi.hwpf.usermodel.BorderCode; import org.apache.poi.hwpf.usermodel.CharacterProperties; diff --git a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordToHtmlExtractor.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java similarity index 94% rename from src/scratchpad/src/org/apache/poi/hwpf/extractor/WordToHtmlExtractor.java rename to src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java index 6f27e443c8..c931acb9c7 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordToHtmlExtractor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlConverter.java @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ -package org.apache.poi.hwpf.extractor; +package org.apache.poi.hwpf.converter; import java.io.File; import java.io.FileWriter; @@ -44,12 +44,18 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Text; -import static org.apache.poi.hwpf.extractor.AbstractWordUtils.TWIPS_PER_INCH; +import static org.apache.poi.hwpf.converter.AbstractWordUtils.TWIPS_PER_INCH; /** + * Converts Word files (95-2007) into HTML files. + *

+ * This implementation doesn't create images or links to them. This can be + * changed by overriding {@link #processImage(Element, boolean, Picture)} + * method. + * * @author Sergey Vladimirov (vlsergey {at} gmail {dot} com) */ -public class WordToHtmlExtractor extends AbstractWordExtractor +public class WordToHtmlConverter extends AbstractWordConverter { /** @@ -69,7 +75,7 @@ public class WordToHtmlExtractor extends AbstractWordExtractor } private static final POILogger logger = POILogFactory - .getLogger( WordToHtmlExtractor.class ); + .getLogger( WordToHtmlConverter.class ); private static String getSectionStyle( Section section ) { @@ -100,10 +106,10 @@ public class WordToHtmlExtractor extends AbstractWordExtractor } /** - * Java main() interface to interact with WordToHtmlExtractor + * Java main() interface to interact with {@link WordToHtmlConverter} * *

- * Usage: WordToHtmlExtractor infile outfile + * Usage: WordToHtmlConverter infile outfile *

* Where infile is an input .doc file ( Word 95-2007) which will be rendered * as HTML into outfile @@ -113,7 +119,7 @@ public class WordToHtmlExtractor extends AbstractWordExtractor if ( args.length < 2 ) { System.err - .println( "Usage: WordToHtmlExtractor " ); + .println( "Usage: WordToHtmlConverter " ); return; } @@ -121,7 +127,7 @@ public class WordToHtmlExtractor extends AbstractWordExtractor System.out.println( "Saving output to " + args[1] ); try { - Document doc = WordToHtmlExtractor.process( new File( args[0] ) ); + Document doc = WordToHtmlConverter.process( new File( args[0] ) ); FileWriter out = new FileWriter( args[1] ); DOMSource domSource = new DOMSource( doc ); @@ -145,11 +151,11 @@ public class WordToHtmlExtractor extends AbstractWordExtractor static Document process( File docFile ) throws Exception { final HWPFDocumentCore wordDocument = WordToHtmlUtils.loadDoc( docFile ); - WordToHtmlExtractor wordToHtmlExtractor = new WordToHtmlExtractor( + WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter( DocumentBuilderFactory.newInstance().newDocumentBuilder() .newDocument() ); - wordToHtmlExtractor.processDocument( wordDocument ); - return wordToHtmlExtractor.getDocument(); + wordToHtmlConverter.processDocument( wordDocument ); + return wordToHtmlConverter.getDocument(); } private final Stack blocksProperies = new Stack(); @@ -157,13 +163,13 @@ public class WordToHtmlExtractor extends AbstractWordExtractor private final HtmlDocumentFacade htmlDocumentFacade; /** - * Creates new instance of {@link WordToHtmlExtractor}. Can be used for + * Creates new instance of {@link WordToHtmlConverter}. Can be used for * output several {@link HWPFDocument}s into single HTML document. * * @param document * XML DOM Document used as HTML document */ - public WordToHtmlExtractor( Document document ) + public WordToHtmlConverter( Document document ) { this.htmlDocumentFacade = new HtmlDocumentFacade( document ); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordToHtmlUtils.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlUtils.java similarity index 99% rename from src/scratchpad/src/org/apache/poi/hwpf/extractor/WordToHtmlUtils.java rename to src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlUtils.java index 4417f62017..598def658a 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordToHtmlUtils.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlUtils.java @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ -package org.apache.poi.hwpf.extractor; +package org.apache.poi.hwpf.converter; import org.apache.poi.hwpf.usermodel.BorderCode; import org.apache.poi.hwpf.usermodel.CharacterProperties; diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordToExtractorSuite.java b/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToConverterSuite.java similarity index 91% rename from src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordToExtractorSuite.java rename to src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToConverterSuite.java index 62cfb999bc..570c8d155d 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordToExtractorSuite.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToConverterSuite.java @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ -package org.apache.poi.hwpf.extractor; +package org.apache.poi.hwpf.converter; import java.io.File; import java.io.FilenameFilter; @@ -35,7 +35,7 @@ import junit.framework.TestSuite; import org.apache.poi.POIDataSamples; import org.apache.poi.hwpf.HWPFDocumentCore; -public class TestWordToExtractorSuite +public class TestWordToConverterSuite { /** * YK: a quick hack to exclude failing documents from the suite. @@ -87,14 +87,14 @@ public class TestWordToExtractorSuite } catch ( Exception exc ) { - // unable to parse file -- not WordToFoExtractor fault + // unable to parse file -- not WordToFoConverter fault return; } - WordToFoExtractor wordToFoExtractor = new WordToFoExtractor( + WordToFoConverter wordToFoConverter = new WordToFoConverter( DocumentBuilderFactory.newInstance().newDocumentBuilder() .newDocument() ); - wordToFoExtractor.processDocument( hwpfDocument ); + wordToFoConverter.processDocument( hwpfDocument ); StringWriter stringWriter = new StringWriter(); @@ -103,7 +103,7 @@ public class TestWordToExtractorSuite transformer.setOutputProperty( OutputKeys.ENCODING, "utf-8" ); transformer.setOutputProperty( OutputKeys.INDENT, "yes" ); transformer.transform( - new DOMSource( wordToFoExtractor.getDocument() ), + new DOMSource( wordToFoConverter.getDocument() ), new StreamResult( stringWriter ) ); if ( html ) diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordToFoExtractor.java b/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToFoConverter.java similarity index 90% rename from src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordToFoExtractor.java rename to src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToFoConverter.java index 8bcd5bb21c..33321987f1 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordToFoExtractor.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToFoConverter.java @@ -16,7 +16,7 @@ * limitations under the License. * ==================================================================== */ -package org.apache.poi.hwpf.extractor; +package org.apache.poi.hwpf.converter; import java.io.StringWriter; @@ -32,11 +32,11 @@ import org.apache.poi.POIDataSamples; import org.apache.poi.hwpf.HWPFDocument; /** - * Test cases for {@link WordToFoExtractor} + * Test cases for {@link WordToFoConverter} * * @author Sergey Vladimirov (vlsergey {at} gmail {dot} com) */ -public class TestWordToFoExtractor extends TestCase +public class TestWordToFoConverter extends TestCase { private static String getFoText( final String sampleFileName ) throws Exception @@ -44,10 +44,10 @@ public class TestWordToFoExtractor extends TestCase HWPFDocument hwpfDocument = new HWPFDocument( POIDataSamples .getDocumentInstance().openResourceAsStream( sampleFileName ) ); - WordToFoExtractor wordToFoExtractor = new WordToFoExtractor( + WordToFoConverter wordToFoConverter = new WordToFoConverter( DocumentBuilderFactory.newInstance().newDocumentBuilder() .newDocument() ); - wordToFoExtractor.processDocument( hwpfDocument ); + wordToFoConverter.processDocument( hwpfDocument ); StringWriter stringWriter = new StringWriter(); @@ -55,30 +55,30 @@ public class TestWordToFoExtractor extends TestCase .newTransformer(); transformer.setOutputProperty( OutputKeys.INDENT, "yes" ); transformer.transform( - new DOMSource( wordToFoExtractor.getDocument() ), + new DOMSource( wordToFoConverter.getDocument() ), new StreamResult( stringWriter ) ); String result = stringWriter.toString(); return result; } - public void testHyperlink() throws Exception + public void testEquation() throws Exception { - final String sampleFileName = "hyperlink.doc"; + final String sampleFileName = "equation.doc"; String result = getFoText( sampleFileName ); assertTrue( result - .contains( "" ) ); - assertTrue( result.contains( "Hyperlink text" ) ); + .contains( "" ) ); } - public void testEquation() throws Exception + public void testHyperlink() throws Exception { - final String sampleFileName = "equation.doc"; + final String sampleFileName = "hyperlink.doc"; String result = getFoText( sampleFileName ); assertTrue( result - .contains( "" ) ); + .contains( "" ) ); + assertTrue( result.contains( "Hyperlink text" ) ); } public void testPageref() throws Exception diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordToHtmlExtractor.java b/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java similarity index 90% rename from src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordToHtmlExtractor.java rename to src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java index f758e6fe24..890bce6e6c 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordToHtmlExtractor.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ -package org.apache.poi.hwpf.extractor; +package org.apache.poi.hwpf.converter; import java.io.StringWriter; @@ -30,11 +30,11 @@ import org.apache.poi.POIDataSamples; import org.apache.poi.hwpf.HWPFDocument; /** - * Test cases for {@link WordToFoExtractor} + * Test cases for {@link WordToFoConverter} * * @author Sergey Vladimirov (vlsergey {at} gmail {dot} com) */ -public class TestWordToHtmlExtractor extends TestCase +public class TestWordToHtmlConverter extends TestCase { private static String getHtmlText( final String sampleFileName ) throws Exception @@ -42,10 +42,10 @@ public class TestWordToHtmlExtractor extends TestCase HWPFDocument hwpfDocument = new HWPFDocument( POIDataSamples .getDocumentInstance().openResourceAsStream( sampleFileName ) ); - WordToHtmlExtractor wordToHtmlExtractor = new WordToHtmlExtractor( + WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter( DocumentBuilderFactory.newInstance().newDocumentBuilder() .newDocument() ); - wordToHtmlExtractor.processDocument( hwpfDocument ); + wordToHtmlConverter.processDocument( hwpfDocument ); StringWriter stringWriter = new StringWriter(); @@ -55,7 +55,7 @@ public class TestWordToHtmlExtractor extends TestCase transformer.setOutputProperty( OutputKeys.ENCODING, "utf-8" ); transformer.setOutputProperty( OutputKeys.METHOD, "html" ); transformer.transform( - new DOMSource( wordToHtmlExtractor.getDocument() ), + new DOMSource( wordToHtmlConverter.getDocument() ), new StreamResult( stringWriter ) ); String result = stringWriter.toString(); -- 2.39.5