diff --git a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java index 424ff1b91..49c966a31 100644 --- a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java +++ b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java @@ -16,7 +16,7 @@ ==================================================================== */ package org.apache.poi.xssf.eventusermodel; -import static org.apache.poi.xssf.usermodel.XSSFRelation.SPREADSHEETML_NS; +import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_SPREADSHEETML; import java.util.LinkedList; import java.util.Queue; @@ -191,7 +191,7 @@ public class XSSFSheetXMLHandler extends DefaultHandler { public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { - if (uri != null && ! uri.equals(SPREADSHEETML_NS)) { + if (uri != null && ! uri.equals(NS_SPREADSHEETML)) { return; } @@ -297,7 +297,7 @@ public class XSSFSheetXMLHandler extends DefaultHandler { public void endElement(String uri, String localName, String qName) throws SAXException { - if (uri != null && ! uri.equals(SPREADSHEETML_NS)) { + if (uri != null && ! uri.equals(NS_SPREADSHEETML)) { return; } diff --git a/src/ooxml/java/org/apache/poi/xssf/model/SharedStringsTable.java b/src/ooxml/java/org/apache/poi/xssf/model/SharedStringsTable.java index 6f5d5bc32..5280cb205 100644 --- a/src/ooxml/java/org/apache/poi/xssf/model/SharedStringsTable.java +++ b/src/ooxml/java/org/apache/poi/xssf/model/SharedStringsTable.java @@ -18,7 +18,7 @@ package org.apache.poi.xssf.model; import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS; -import static org.apache.poi.xssf.usermodel.XSSFRelation.SPREADSHEETML_NS; +import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_SPREADSHEETML; import java.io.IOException; import java.io.InputStream; @@ -91,7 +91,7 @@ public class SharedStringsTable extends POIXMLDocumentPart { options.put( XmlOptions.SAVE_INNER ); options.put( XmlOptions.SAVE_AGGRESSIVE_NAMESPACES ); options.put( XmlOptions.SAVE_USE_DEFAULT_NAMESPACE ); - options.setSaveImplicitNamespaces(Collections.singletonMap("", SPREADSHEETML_NS)); + options.setSaveImplicitNamespaces(Collections.singletonMap("", NS_SPREADSHEETML)); } public SharedStringsTable() { diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChart.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChart.java index f6d683461..ae63f235d 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChart.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChart.java @@ -63,9 +63,6 @@ import org.w3c.dom.Text; /** * Represents a SpreadsheetML Chart - * @author Nick Burch - * @author Roman Kashitsyn - * @author Martin Andersson */ public final class XSSFChart extends POIXMLDocumentPart implements Chart, ChartAxisFactory { diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java index 1ce809fa2..27ef139b0 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java @@ -52,8 +52,6 @@ import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.STEditAs; /** * Represents a SpreadsheetML drawing - * - * @author Yegor Kozlov */ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing { /** @@ -62,8 +60,8 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing { private CTDrawing drawing; private long numOfGraphicFrames = 0L; - protected static final String NAMESPACE_A = "http://schemas.openxmlformats.org/drawingml/2006/main"; - protected static final String NAMESPACE_C = "http://schemas.openxmlformats.org/drawingml/2006/chart"; + protected static final String NAMESPACE_A = XSSFRelation.NS_DRAWINGML; + protected static final String NAMESPACE_C = XSSFRelation.NS_CHART; /** * Create a new SpreadsheetML drawing diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java index de49e8025..ac2f83567 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java @@ -352,7 +352,9 @@ public final class XSSFRelation extends POIXMLRelation { null ); - public static final String SPREADSHEETML_NS = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"; + public static final String NS_SPREADSHEETML = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"; + public static final String NS_DRAWINGML = "http://schemas.openxmlformats.org/drawingml/2006/main"; + public static final String NS_CHART = "http://schemas.openxmlformats.org/drawingml/2006/chart"; private XSSFRelation(String type, String rel, String defaultName, Class cls) { super(type, rel, defaultName, cls); diff --git a/src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFImportFromXML.java b/src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFImportFromXML.java index 51a5074f6..626e104a0 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFImportFromXML.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFImportFromXML.java @@ -17,7 +17,7 @@ package org.apache.poi.xssf.extractor; -import static org.apache.poi.xssf.usermodel.XSSFRelation.SPREADSHEETML_NS; +import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_SPREADSHEETML; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; @@ -98,7 +98,7 @@ public class TestXSSFImportFromXML { String cellC8 = "c8"; String cellC9 = "c9"; - String testXML = "" + + String testXML = "" + ""+ ""+ ""+ @@ -143,7 +143,7 @@ public class TestXSSFImportFromXML { int count = 21; String testXML = ""+ - ""+ + ""+ ""+ "\u0000"; XSSFMap map = wb.getMapInfo().getXSSFMapByName("table_mapping"); diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java index 412095846..717fc4e6b 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java @@ -17,7 +17,7 @@ package org.apache.poi.xssf.usermodel; -import static org.apache.poi.xssf.usermodel.XSSFRelation.SPREADSHEETML_NS; +import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_SPREADSHEETML; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; @@ -147,7 +147,7 @@ public final class TestXSSFComment extends BaseTestCellComment { CTComment ctComment = comment.getCTComment(); XmlObject[] obj = ctComment.selectPath( - "declare namespace w='"+SPREADSHEETML_NS+"' .//w:text"); + "declare namespace w='"+NS_SPREADSHEETML+"' .//w:text"); assertEquals(1, obj.length); assertEquals(TEST_RICHTEXTSTRING, comment.getString().getString()); @@ -165,7 +165,7 @@ public final class TestXSSFComment extends BaseTestCellComment { //check the low-level stuff comment.setString(richText); obj = ctComment.selectPath( - "declare namespace w='"+SPREADSHEETML_NS+"' .//w:text"); + "declare namespace w='"+NS_SPREADSHEETML+"' .//w:text"); assertEquals(1, obj.length); assertSame(comment.getString(), richText); //check that the rich text is set in the comment