==================================================================== */
package org.apache.poi.xssf.eventusermodel;
+import static org.apache.poi.xssf.usermodel.XSSFRelation.SPREADSHEETML_NS;
+
import java.util.LinkedList;
import java.util.Queue;
*/
public class XSSFSheetXMLHandler extends DefaultHandler {
private static final POILogger logger = POILogFactory.getLogger(XSSFSheetXMLHandler.class);
- static final String SPREADSHEETML_NS = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
+
/**
* These are the different kinds of cells we support.
* We keep track of the current one between
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 java.io.IOException;
import java.io.InputStream;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSst;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.SstDocument;
-
/**
* Table of strings shared across all sheets in a workbook.
* <p>
* The shared string table contains all the necessary information for displaying the string: the text, formatting
* properties, and phonetic properties (for East Asian languages).
* </p>
- *
- * @author Nick Birch
- * @author Yegor Kozlov
*/
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("", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"));
+ options.setSaveImplicitNamespaces(Collections.singletonMap("", SPREADSHEETML_NS));
}
public SharedStringsTable() {
import org.apache.poi.xssf.model.ThemesTable;
/**
- *
+ * Defines namespaces, content types and normal file names / naming
+ * patterns, for the well-known XSSF format parts.
*/
public final class XSSFRelation extends POIXMLRelation {
"/xl/ctrlProps/ctrlProp#.xml",
null
);
+
+ public static final String SPREADSHEETML_NS = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
private XSSFRelation(String type, String rel, String defaultName, Class<? extends POIXMLDocumentPart> cls) {
super(type, rel, defaultName, cls);
package org.apache.poi.xssf.extractor;
+import static org.apache.poi.xssf.usermodel.XSSFRelation.SPREADSHEETML_NS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.junit.Test;
import org.xml.sax.SAXException;
-/**
- *
- * @author Roberto Manicardi
- *
- */
public class TestXSSFImportFromXML {
@Test
String cellC8 = "c8";
String cellC9 = "c9";
- String testXML = "<ns1:MapInfo xmlns:ns1=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" SelectionNamespaces=\"\">" +
+ String testXML = "<ns1:MapInfo xmlns:ns1=\""+SPREADSHEETML_NS+"\" SelectionNamespaces=\"\">" +
"<ns1:Schema ID=\""+cellC6+"\" SchemaRef=\"a\" />"+
"<ns1:Schema ID=\""+cellC7+"\" SchemaRef=\"b\" />"+
"<ns1:Schema ID=\""+cellC8+"\" SchemaRef=\"c\" />"+
int count = 21;
String testXML = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>"+
- "<ns1:table xmlns:ns1=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" id=\""+id+"\" displayName=\""+displayName+"\" ref=\""+ref+"\">"+
+ "<ns1:table xmlns:ns1=\""+SPREADSHEETML_NS+"\" id=\""+id+"\" displayName=\""+displayName+"\" ref=\""+ref+"\">"+
"<ns1:tableColumns count=\""+count+"\" />"+
"</ns1:table>\u0000";
XSSFMap map = wb.getMapInfo().getXSSFMapByName("table_mapping");
package org.apache.poi.xssf.usermodel;
+import static org.apache.poi.xssf.usermodel.XSSFRelation.SPREADSHEETML_NS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
CTComment ctComment = comment.getCTComment();
XmlObject[] obj = ctComment.selectPath(
- "declare namespace w='http://schemas.openxmlformats.org/spreadsheetml/2006/main' .//w:text");
+ "declare namespace w='"+SPREADSHEETML_NS+"' .//w:text");
assertEquals(1, obj.length);
assertEquals(TEST_RICHTEXTSTRING, comment.getString().getString());
//check the low-level stuff
comment.setString(richText);
obj = ctComment.selectPath(
- "declare namespace w='http://schemas.openxmlformats.org/spreadsheetml/2006/main' .//w:text");
+ "declare namespace w='"+SPREADSHEETML_NS+"' .//w:text");
assertEquals(1, obj.length);
assertSame(comment.getString(), richText);
//check that the rich text is set in the comment