poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From max...@apache.org
Subject svn commit: r1141915 - /poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFCommonSlideData.java
Date Fri, 01 Jul 2011 12:21:05 GMT
Author: maxcom
Date: Fri Jul  1 12:21:05 2011
New Revision: 1141915

URL: http://svn.apache.org/viewvc?rev=1141915&view=rev
Log:
XSLFCommonSlideData: Workaround for XmlBeans bug#49934

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFCommonSlideData.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFCommonSlideData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFCommonSlideData.java?rev=1141915&r1=1141914&r2=1141915&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFCommonSlideData.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFCommonSlideData.java Fri Jul
 1 12:21:05 2011
@@ -17,8 +17,11 @@
 
 package org.apache.poi.xslf.usermodel;
 
+import org.apache.poi.POIXMLException;
 import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.values.XmlAnyTypeImpl;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObjectData;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTable;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody;
@@ -52,11 +55,20 @@ public class XSLFCommonSlideData {
         for (CTGraphicalObjectFrame frame: gs.getGraphicFrameList()) {
             CTGraphicalObjectData data = frame.getGraphic().getGraphicData();
             XmlCursor c = data.newCursor();
-            c.selectPath("./*");
+            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());
+                    } catch (XmlException e) {
+                        throw new POIXMLException(e);
+                    }
+                }
+
                 if (o instanceof CTTable) {
                     DrawingTable table = new DrawingTable((CTTable) o);
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message