import java.util.Map;
import org.apache.poi.openxml4j.opc.PackageNamespaces;
-import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.apache.poi.xssf.usermodel.XSSFRelation;
import org.apache.xmlbeans.XmlOptions;
public class POIXMLTypeLoader {
map.put("http://schemas.openxmlformats.org/officeDocument/2006/math", "m");
map.put("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r");
map.put("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", "vt");
- map.put("http://schemas.openxmlformats.org/presentationml/2006/main", "p");
- map.put(XWPFDocument.NS_OOXML_WP_MAIN, "w");
+ map.put(XSSFRelation.NS_PRESENTATIONML, "p");
+ map.put(XSSFRelation.NS_WORDPROCESSINGML, "w");
map.put("http://schemas.microsoft.com/office/word/2006/wordml", "wne");
map.put(MS_OFFICE_URN, "o");
map.put(MS_EXCEL_URN, "x");
package org.apache.poi.xslf.model;
import static org.apache.poi.ooxml.util.XPathHelper.selectProperty;
+import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_PRESENTATIONML;
import java.util.function.Consumer;
}
- static final String PML_NS = "http://schemas.openxmlformats.org/presentationml/2006/main";
+ static final String PML_NS = NS_PRESENTATIONML;
static final String DML_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
private static final QName[] TX_BODY = { new QName(PML_NS, "txBody") };
import org.openxmlformats.schemas.presentationml.x2006.main.CTPicture;
import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
+import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_PRESENTATIONML;
@Beta
public class XSLFDrawing {
_sheet = sheet;
_spTree = spTree;
XmlObject[] cNvPr = sheet.getSpTree().selectPath(
- "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:cNvPr");
+ "declare namespace p='" + NS_PRESENTATIONML + "' .//*/p:cNvPr");
for(XmlObject o : cNvPr) {
// powerpoint generates AlternateContent elements which cNvPr elements aren't recognized
// ignore them for now
package org.apache.poi.xslf.usermodel;
import static org.apache.poi.openxml4j.opc.PackageRelationshipTypes.CORE_PROPERTIES_ECMA376_NS;
+import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_WORDPROCESSINGML;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
@Override
public XSLFPictureShape getFallbackPicture() {
String xquery =
- "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main'; "
+ "declare namespace p='" + NS_WORDPROCESSINGML + "'; "
+ "declare namespace mc='http://schemas.openxmlformats.org/markup-compatibility/2006' "
+ ".//mc:Fallback/*/p:pic"
;
import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType;
+import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_PRESENTATIONML;
+
/**
* Base super-class class for all shapes in PresentationML
*/
}
static final String DML_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
- static final String PML_NS = "http://schemas.openxmlformats.org/presentationml/2006/main";
+ static final String PML_NS = NS_PRESENTATIONML;
private static final QName[] NV_CONTAINER = {
new QName(PML_NS, "nvSpPr"),
import static org.apache.logging.log4j.util.Unbox.box;
import static org.apache.poi.ooxml.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
+import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_PRESENTATIONML;
import java.awt.*;
import java.awt.geom.Rectangle2D;
if(_spTree == null) {
XmlObject root = getXmlObject();
XmlObject[] sp = root.selectPath(
- "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//*/p:spTree");
+ "declare namespace p='" + NS_PRESENTATIONML + "' .//*/p:spTree");
if(sp.length == 0) {
throw new IllegalStateException("CTGroupShape was not found");
}
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
String docName = getRootElementName();
if(docName != null) {
- xmlOptions.setSaveSyntheticDocumentElement(
- new QName("http://schemas.openxmlformats.org/presentationml/2006/main", docName));
+ xmlOptions.setSaveSyntheticDocumentElement(new QName(NS_PRESENTATIONML, docName));
}
PackagePart part = getPackagePart();
import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder;
import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType;
+import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_PRESENTATIONML;
+
/**
* Represents a paragraph of text within the containing text body.
* The paragraph is the highest level text separation mechanism.
int level = getIndentLevel();
// wind up and find the root master sheet which must be slide master
- final String nsPML = "http://schemas.openxmlformats.org/presentationml/2006/main";
+ final String nsPML = NS_PRESENTATIONML;
XSLFSheet masterSheet = _shape.getSheet();
for (XSLFSheet m = masterSheet; m != null; m = (XSLFSheet)m.getMasterSheet()) {
masterSheet = m;
"/xl/customProperty#.bin"
);
+ public static final String NS_PRESENTATIONML = "http://schemas.openxmlformats.org/presentationml/2006/main";
+ public static final String NS_WORDPROCESSINGML = "http://schemas.openxmlformats.org/wordprocessingml/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";
*/
@SuppressWarnings("unused")
public class XWPFDocument extends POIXMLDocument implements Document, IBody {
- public static final String NS_OOXML_WP_MAIN = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
private static final Logger LOG = LogManager.getLogger(XWPFDocument.class);
protected List<XWPFFooter> footers = new ArrayList<>();
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import java.util.Locale;
import javax.xml.namespace.QName;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.util.*;
import org.apache.poi.wp.usermodel.CharacterRun;
+import org.apache.poi.xssf.usermodel.XSSFRelation;
import org.apache.xmlbeans.*;
import org.apache.xmlbeans.impl.values.XmlAnyTypeImpl;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTChart;
pictTextObjs.addAll(Arrays.asList(r.getPictArray()));
pictTextObjs.addAll(Arrays.asList(r.getDrawingArray()));
for (XmlObject o : pictTextObjs) {
- XmlObject[] ts = o.selectPath("declare namespace w='" + XWPFDocument.NS_OOXML_WP_MAIN + "' .//w:t");
+ XmlObject[] ts = o.selectPath("declare namespace w='" + XSSFRelation.NS_WORDPROCESSINGML + "' .//w:t");
for (XmlObject t : ts) {
NodeList kids = t.getDomNode().getChildNodes();
for (int n = 0; n < kids.getLength(); n++) {
XmlObject o = c.getObject();
if (o instanceof CTRubyContent) {
final Node node = o.getDomNode();
- if (XWPFDocument.NS_OOXML_WP_MAIN.equals(node.getNamespaceURI())) {
+ if (XSSFRelation.NS_WORDPROCESSINGML.equals(node.getNamespaceURI())) {
final String tagName = node.getLocalName();
if ("rt".equals(tagName)) {
inRT = true;
// Field Codes (w:instrText, defined in spec sec. 17.16.23)
// come up as instances of CTText, but we don't want them
// in the normal text output
- if (!("instrText".equals(node.getLocalName()) && XWPFDocument.NS_OOXML_WP_MAIN.equals(node.getNamespaceURI()))) {
+ if (!("instrText".equals(node.getLocalName()) && XSSFRelation.NS_WORDPROCESSINGML.equals(node.getNamespaceURI()))) {
String textValue = ((CTText) o).getStringValue();
if (textValue != null) {
if (isCapitalized() || isSmallCaps()) {
// This bit works around it, and replicates the above
// rules for that case
final Node node = o.getDomNode();
- if (XWPFDocument.NS_OOXML_WP_MAIN.equals(node.getNamespaceURI())) {
+ if (XSSFRelation.NS_WORDPROCESSINGML.equals(node.getNamespaceURI())) {
switch (node.getLocalName()) {
case "tab":
text.append('\t');
import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPicture;
-import static org.apache.poi.xwpf.usermodel.XWPFDocument.NS_OOXML_WP_MAIN;
+import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_WORDPROCESSINGML;
public class XWPFSignatureLine extends SignatureLine {
private static final String MS_VML_URN = "urn:schemas-microsoft-com:vml";
public void parse(XWPFDocument doc) throws XmlException {
line = XPathHelper.selectProperty(doc.getDocument(), CTSignatureLine.class, null,
- new QName[]{new QName(NS_OOXML_WP_MAIN, "body")},
- new QName[]{new QName(NS_OOXML_WP_MAIN, "p")},
- new QName[]{new QName(NS_OOXML_WP_MAIN, "r")},
- new QName[]{new QName(NS_OOXML_WP_MAIN, "pict")},
+ new QName[]{new QName(NS_WORDPROCESSINGML, "body")},
+ new QName[]{new QName(NS_WORDPROCESSINGML, "p")},
+ new QName[]{new QName(NS_WORDPROCESSINGML, "r")},
+ new QName[]{new QName(NS_WORDPROCESSINGML, "pict")},
new QName[]{new QName(MS_VML_URN, "shape")},
new QName[]{QNAME_SIGNATURE_LINE});
if (line != null) {