Pull out two more XSSF namespace definitions as re-usable constants
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1731980 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
094e3f68e6
commit
194fdfe162
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -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
|
||||
|
@ -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<? extends POIXMLDocumentPart> cls) {
|
||||
super(type, rel, defaultName, cls);
|
||||
|
@ -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 = "<ns1:MapInfo xmlns:ns1=\""+SPREADSHEETML_NS+"\" SelectionNamespaces=\"\">" +
|
||||
String testXML = "<ns1:MapInfo xmlns:ns1=\""+NS_SPREADSHEETML+"\" SelectionNamespaces=\"\">" +
|
||||
"<ns1:Schema ID=\""+cellC6+"\" SchemaRef=\"a\" />"+
|
||||
"<ns1:Schema ID=\""+cellC7+"\" SchemaRef=\"b\" />"+
|
||||
"<ns1:Schema ID=\""+cellC8+"\" SchemaRef=\"c\" />"+
|
||||
@ -143,7 +143,7 @@ public class TestXSSFImportFromXML {
|
||||
int count = 21;
|
||||
|
||||
String testXML = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>"+
|
||||
"<ns1:table xmlns:ns1=\""+SPREADSHEETML_NS+"\" id=\""+id+"\" displayName=\""+displayName+"\" ref=\""+ref+"\">"+
|
||||
"<ns1:table xmlns:ns1=\""+NS_SPREADSHEETML+"\" id=\""+id+"\" displayName=\""+displayName+"\" ref=\""+ref+"\">"+
|
||||
"<ns1:tableColumns count=\""+count+"\" />"+
|
||||
"</ns1:table>\u0000";
|
||||
XSSFMap map = wb.getMapInfo().getXSSFMapByName("table_mapping");
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user