use of org.apache.xmlbeans.XmlException in project poi by apache.
the class XSSFPivotCacheDefinition method readFrom.
@Beta
public void readFrom(InputStream is) throws IOException {
try {
XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
//Removing root element
options.setLoadReplaceDocumentElement(null);
ctPivotCacheDefinition = CTPivotCacheDefinition.Factory.parse(is, options);
} catch (XmlException e) {
throw new IOException(e.getLocalizedMessage(), e);
}
}
use of org.apache.xmlbeans.XmlException in project poi by apache.
the class XSSFPivotCacheRecords method readFrom.
@Beta
protected void readFrom(InputStream is) throws IOException {
try {
XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
//Removing root element
options.setLoadReplaceDocumentElement(null);
ctPivotCacheRecords = CTPivotCacheRecords.Factory.parse(is, options);
} catch (XmlException e) {
throw new IOException(e.getLocalizedMessage());
}
}
use of org.apache.xmlbeans.XmlException in project poi by apache.
the class XSSFPivotTable method readFrom.
@Beta
public void readFrom(InputStream is) throws IOException {
try {
XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
//Removing root element
options.setLoadReplaceDocumentElement(null);
pivotTableDefinition = CTPivotTableDefinition.Factory.parse(is, options);
} catch (XmlException e) {
throw new IOException(e.getLocalizedMessage());
}
}
use of org.apache.xmlbeans.XmlException in project poi by apache.
the class XSLFPictureShape method getBlipFill.
protected CTBlipFillProperties getBlipFill() {
CTPicture ct = (CTPicture) getXmlObject();
CTBlipFillProperties bfp = ct.getBlipFill();
if (bfp != null) {
return bfp;
}
String xquery = "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main'; " + "declare namespace mc='http://schemas.openxmlformats.org/markup-compatibility/2006' " + ".//mc:Fallback/p:blipFill";
XmlObject xo = selectProperty(XmlObject.class, xquery);
try {
xo = CTPicture.Factory.parse(xo.getDomNode());
} catch (XmlException xe) {
return null;
}
return ((CTPicture) xo).getBlipFill();
}
use of org.apache.xmlbeans.XmlException in project poi by apache.
the class XSLFCommonSlideData method getDrawingText.
public List<DrawingTextBody> getDrawingText() {
CTGroupShape gs = data.getSpTree();
List<DrawingTextBody> out = new ArrayList<DrawingTextBody>();
processShape(gs, out);
for (CTGroupShape shape : gs.getGrpSpArray()) {
processShape(shape, out);
}
for (CTGraphicalObjectFrame frame : gs.getGraphicFrameArray()) {
CTGraphicalObjectData data = frame.getGraphic().getGraphicData();
XmlCursor c = data.newCursor();
c.selectPath("declare namespace pic='" + CTTable.type.getName().getNamespaceURI() + "' .//pic:tbl");
while (c.toNextSelection()) {
XmlObject o = c.getObject();
if (o instanceof XmlAnyTypeImpl) {
// Pesky XmlBeans bug - see Bugzilla #49934
try {
o = CTTable.Factory.parse(o.toString(), DEFAULT_XML_OPTIONS);
} catch (XmlException e) {
throw new POIXMLException(e);
}
}
if (o instanceof CTTable) {
DrawingTable table = new DrawingTable((CTTable) o);
for (DrawingTableRow row : table.getRows()) {
for (DrawingTableCell cell : row.getCells()) {
DrawingTextBody textBody = cell.getTextBody();
out.add(textBody);
}
}
}
}
c.dispose();
}
return out;
}
Aggregations