无法使用Apache POI 3.13解析CTDataModel

时间:2016-11-25 11:43:03

标签: java xml apache-poi openxml

我正在尝试以编程方式更新某些文本并更改基于openxml格式2006的演示文稿文件(.pptx)的SmartArt列表对象中的图像。我成功地搜索并替换了图表data1.xml文件中的文本通过xml字符串上的replaceAll方法但我无法使用CTDataModel.Factory.parse(文件文件)方法解析CTDataModel文件

下面是Diagram数据文件的xml文件。它有三个子弹列表,包含文本和嵌入图像作为关系。我需要得到文本出现的元素的modelId和嵌入的图像关系,然后将该关系的目标更改为其他图像

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <dgm:dataModel 
        xmlns:dgm="http://schemas.openxmlformats.org/drawingml/2006/diagram" 
        xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
        <dgm:ptLst>
            <dgm:pt modelId="{6E828954-E836-4BD0-9322-01425757D12F}" type="doc">
                <dgm:prSet loTypeId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList" loCatId="list" qsTypeId="urn:microsoft.com/office/officeart/2005/8/quickstyle/simple4" qsCatId="simple" csTypeId="urn:microsoft.com/office/officeart/2005/8/colors/accent6_2" csCatId="accent6" phldr="1"/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{1FE2E35A-12AB-4CE4-9E4D-12D87B7FDFFA}">
                <dgm:prSet custT="1"/>
                <dgm:spPr>
                    <a:noFill/>
                </dgm:spPr>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:pPr rtl="0"/>
                        <a:r>
                            <a:rPr lang="en-US" sz="1800" dirty="0" smtClean="0"/>
                            <a:t>TEXT_TO_REPLACE_1</a:t>
                        </a:r>
                        <a:endParaRPr lang="en-US" sz="1800" dirty="0"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{F2EF8CE4-27D6-484A-90E0-4014CC11265A}" type="parTrans" cxnId="{0C7C15A9-E9DC-45BA-A98B-C3764E94A709}">
                <dgm:prSet/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{BC0ED768-24E5-4223-9AC9-FA49E959BBB8}" type="sibTrans" cxnId="{0C7C15A9-E9DC-45BA-A98B-C3764E94A709}">
                <dgm:prSet/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{AE017508-C3D7-4D8A-BBF2-0210789EACA4}">
                <dgm:prSet custT="1"/>
                <dgm:spPr>
                    <a:noFill/>
                </dgm:spPr>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:pPr rtl="0"/>
                        <a:r>
                            <a:rPr lang="en-US" sz="1800" dirty="0" smtClean="0"/>
                            <a:t>TEXT_TO_REPLACE_2</a:t>
                        </a:r>
                        <a:endParaRPr lang="en-US" sz="1800" dirty="0"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{45BA471A-EB29-48B5-A787-D53143938D0C}" type="parTrans" cxnId="{67ADBEDD-9195-4B40-A75C-CDF23813823E}">
                <dgm:prSet/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{E2796C20-8868-4DB7-9502-63CFC0E8753B}" type="sibTrans" cxnId="{67ADBEDD-9195-4B40-A75C-CDF23813823E}">
                <dgm:prSet/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{95A7619D-EE01-4231-9592-D698A93B2322}">
                <dgm:prSet custT="1"/>
                <dgm:spPr>
                    <a:noFill/>
                </dgm:spPr>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:pPr rtl="0"/>
                        <a:r>                        
                            <a:rPr lang="en-US" sz="1800" dirty="0" smtClean="0"/>
                            <a:t>TEXT_TO_REPLACE_3</a:t>
                        </a:r>
                        <a:endParaRPr lang="en-US" sz="1800" dirty="0"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{068714CB-B91F-401C-B4E0-B84378440430}" type="parTrans" cxnId="{29CEF007-255C-401D-BC89-D95CB5347B97}">
                <dgm:prSet/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{3DFEDCED-3FAD-4BD3-A065-E15D56A7F27F}" type="sibTrans" cxnId="{29CEF007-255C-401D-BC89-D95CB5347B97}">
                <dgm:prSet/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{08F6EB28-75AD-4850-AAB7-B04C1DFF72DC}" type="pres">
                <dgm:prSet presAssocID="{6E828954-E836-4BD0-9322-01425757D12F}" presName="Name0" presStyleCnt="0">
                    <dgm:presLayoutVars>
                        <dgm:chMax val="7"/>
                        <dgm:chPref val="7"/>
                        <dgm:dir/>
                    </dgm:presLayoutVars>
                </dgm:prSet>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{6FE0EDBB-C7E9-4A8C-A872-13084DA196BC}" type="pres">
                <dgm:prSet presAssocID="{6E828954-E836-4BD0-9322-01425757D12F}" presName="Name1" presStyleCnt="0"/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{E80E6BD4-B243-45F8-8674-F2FF8DD91C50}" type="pres">
                <dgm:prSet presAssocID="{6E828954-E836-4BD0-9322-01425757D12F}" presName="cycle" presStyleCnt="0"/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{095A698B-B03C-4AB8-89FB-D069EA405182}" type="pres">
                <dgm:prSet presAssocID="{6E828954-E836-4BD0-9322-01425757D12F}" presName="srcNode" presStyleLbl="node1" presStyleIdx="0" presStyleCnt="3"/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{16CC9F8E-6CF4-4834-93AB-676B9823962F}" type="pres">
                <dgm:prSet presAssocID="{6E828954-E836-4BD0-9322-01425757D12F}" presName="conn" presStyleLbl="parChTrans1D2" presStyleIdx="0" presStyleCnt="1"/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{B1F82AB7-F600-4F0F-A819-0E13DB3F39A5}" type="pres">
                <dgm:prSet presAssocID="{6E828954-E836-4BD0-9322-01425757D12F}" presName="extraNode" presStyleLbl="node1" presStyleIdx="0" presStyleCnt="3"/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{AEF027AF-ADD4-41C2-AC2B-13FEDE32C415}" type="pres">
                <dgm:prSet presAssocID="{6E828954-E836-4BD0-9322-01425757D12F}" presName="dstNode" presStyleLbl="node1" presStyleIdx="0" presStyleCnt="3"/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{D41980AA-D309-43F0-BF58-012F2E3D583A}" type="pres">
                <dgm:prSet presAssocID="{95A7619D-EE01-4231-9592-D698A93B2322}" presName="text_1" presStyleLbl="node1" presStyleIdx="0" presStyleCnt="3" custScaleY="100000">
                    <dgm:presLayoutVars>
                        <dgm:bulletEnabled val="1"/>
                    </dgm:presLayoutVars>
                </dgm:prSet>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{C0587850-10BA-48AC-9C96-F2E8DDB81A9C}" type="pres">
                <dgm:prSet presAssocID="{95A7619D-EE01-4231-9592-D698A93B2322}" presName="accent_1" presStyleCnt="0"/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{51DE7F31-6056-41CF-A1F8-5E4E6F252F69}" type="pres">
                <dgm:prSet presAssocID="{95A7619D-EE01-4231-9592-D698A93B2322}" presName="accentRepeatNode" presStyleLbl="solidFgAcc1" presStyleIdx="0" presStyleCnt="3" custScaleX="80000" custScaleY="80000" custLinFactNeighborX="-120" custLinFactNeighborY="-3293"/>
                <dgm:spPr>
                    <a:blipFill dpi="0" rotWithShape="1">
                        <a:blip 
                            xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:embed="rId1">
                            <a:extLst>
                                <a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}">
                                    <a14:useLocalDpi 
                                        xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" val="0"/>
                                </a:ext>
                            </a:extLst>
                        </a:blip>
                        <a:srcRect/>
                        <a:stretch>
                            <a:fillRect/>
                        </a:stretch>
                    </a:blipFill>
                    <a:effectLst>
                        <a:innerShdw blurRad="63500" dist="50800">
                            <a:prstClr val="black">
                                <a:alpha val="50000"/>
                            </a:prstClr>
                        </a:innerShdw>
                        <a:softEdge rad="12700"/>
                    </a:effectLst>
                </dgm:spPr>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{53F8E7B3-14F1-47DB-8D1A-02FE4CCB21A0}" type="pres">
                <dgm:prSet presAssocID="{AE017508-C3D7-4D8A-BBF2-0210789EACA4}" presName="text_2" presStyleLbl="node1" presStyleIdx="1" presStyleCnt="3" custScaleX="103369">
                    <dgm:presLayoutVars>
                        <dgm:bulletEnabled val="1"/>
                    </dgm:presLayoutVars>
                </dgm:prSet>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{7CCDD84D-8793-46A5-97DD-F61AD62325F9}" type="pres">
                <dgm:prSet presAssocID="{AE017508-C3D7-4D8A-BBF2-0210789EACA4}" presName="accent_2" presStyleCnt="0"/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{FB3CBAC5-6093-4CB4-AF8F-E7B57FB40A72}" type="pres">
                <dgm:prSet presAssocID="{AE017508-C3D7-4D8A-BBF2-0210789EACA4}" presName="accentRepeatNode" presStyleLbl="solidFgAcc1" presStyleIdx="1" presStyleCnt="3" custScaleX="80000" custScaleY="80000"/>
                <dgm:spPr>
                    <a:blipFill dpi="0" rotWithShape="1">
                        <a:blip 
                            xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:embed="rId2">
                            <a:extLst>
                                <a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}">
                                    <a14:useLocalDpi 
                                        xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" val="0"/>
                                </a:ext>
                            </a:extLst>
                        </a:blip>
                        <a:srcRect/>
                        <a:stretch>
                            <a:fillRect/>
                        </a:stretch>
                    </a:blipFill>
                    <a:effectLst>
                        <a:innerShdw blurRad="63500" dist="50800">
                            <a:prstClr val="black">
                                <a:alpha val="50000"/>
                            </a:prstClr>
                        </a:innerShdw>
                        <a:softEdge rad="12700"/>
                    </a:effectLst>
                </dgm:spPr>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{FFD3804D-110E-4588-A985-472E18ED558D}" type="pres">
                <dgm:prSet presAssocID="{1FE2E35A-12AB-4CE4-9E4D-12D87B7FDFFA}" presName="text_3" presStyleLbl="node1" presStyleIdx="2" presStyleCnt="3">
                    <dgm:presLayoutVars>
                        <dgm:bulletEnabled val="1"/>
                    </dgm:presLayoutVars>
                </dgm:prSet>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{D8E95FD7-3C8F-4AD2-B6A0-3B58091DB0D0}" type="pres">
                <dgm:prSet presAssocID="{1FE2E35A-12AB-4CE4-9E4D-12D87B7FDFFA}" presName="accent_3" presStyleCnt="0"/>
                <dgm:spPr/>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
            <dgm:pt modelId="{8ECB4450-30D8-4309-B2D8-B5E9CFB2B24D}" type="pres">
                <dgm:prSet presAssocID="{1FE2E35A-12AB-4CE4-9E4D-12D87B7FDFFA}" presName="accentRepeatNode" presStyleLbl="solidFgAcc1" presStyleIdx="2" presStyleCnt="3" custScaleX="80000" custScaleY="80000"/>
                <dgm:spPr>
                    <a:blipFill dpi="0" rotWithShape="1">
                        <a:blip 
                            xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:embed="rId3">
                            <a:extLst>
                                <a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}">
                                    <a14:useLocalDpi 
                                        xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" val="0"/>
                                </a:ext>
                            </a:extLst>
                        </a:blip>
                        <a:srcRect/>
                        <a:stretch>
                            <a:fillRect/>
                        </a:stretch>
                    </a:blipFill>
                    <a:effectLst>
                        <a:innerShdw blurRad="63500" dist="50800">
                            <a:prstClr val="black">
                                <a:alpha val="50000"/>
                            </a:prstClr>
                        </a:innerShdw>
                        <a:softEdge rad="12700"/>
                    </a:effectLst>
                </dgm:spPr>
                <dgm:t>
                    <a:bodyPr/>
                    <a:lstStyle/>
                    <a:p>
                        <a:endParaRPr lang="en-US"/>
                    </a:p>
                </dgm:t>
            </dgm:pt>
        </dgm:ptLst>
        <dgm:cxnLst>
            <dgm:cxn modelId="{67ADBEDD-9195-4B40-A75C-CDF23813823E}" srcId="{6E828954-E836-4BD0-9322-01425757D12F}" destId="{AE017508-C3D7-4D8A-BBF2-0210789EACA4}" srcOrd="1" destOrd="0" parTransId="{45BA471A-EB29-48B5-A787-D53143938D0C}" sibTransId="{E2796C20-8868-4DB7-9502-63CFC0E8753B}"/>
            <dgm:cxn modelId="{0C7C15A9-E9DC-45BA-A98B-C3764E94A709}" srcId="{6E828954-E836-4BD0-9322-01425757D12F}" destId="{1FE2E35A-12AB-4CE4-9E4D-12D87B7FDFFA}" srcOrd="2" destOrd="0" parTransId="{F2EF8CE4-27D6-484A-90E0-4014CC11265A}" sibTransId="{BC0ED768-24E5-4223-9AC9-FA49E959BBB8}"/>
            <dgm:cxn modelId="{29CEF007-255C-401D-BC89-D95CB5347B97}" srcId="{6E828954-E836-4BD0-9322-01425757D12F}" destId="{95A7619D-EE01-4231-9592-D698A93B2322}" srcOrd="0" destOrd="0" parTransId="{068714CB-B91F-401C-B4E0-B84378440430}" sibTransId="{3DFEDCED-3FAD-4BD3-A065-E15D56A7F27F}"/>
            <dgm:cxn modelId="{07274767-024F-469B-BA85-BB067318BA3B}" type="presOf" srcId="{AE017508-C3D7-4D8A-BBF2-0210789EACA4}" destId="{53F8E7B3-14F1-47DB-8D1A-02FE4CCB21A0}" srcOrd="0" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{B4C43AFD-6BBB-4D36-B616-DD184EBFAABE}" type="presOf" srcId="{3DFEDCED-3FAD-4BD3-A065-E15D56A7F27F}" destId="{16CC9F8E-6CF4-4834-93AB-676B9823962F}" srcOrd="0" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{7C2D3A83-36E8-4BBB-A140-A0BB3155949A}" type="presOf" srcId="{95A7619D-EE01-4231-9592-D698A93B2322}" destId="{D41980AA-D309-43F0-BF58-012F2E3D583A}" srcOrd="0" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{C0CE365C-3217-472E-BB2D-DFD6958D6F5C}" type="presOf" srcId="{1FE2E35A-12AB-4CE4-9E4D-12D87B7FDFFA}" destId="{FFD3804D-110E-4588-A985-472E18ED558D}" srcOrd="0" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{9B034817-56CC-49B7-9D86-53986FEC3EC6}" type="presOf" srcId="{6E828954-E836-4BD0-9322-01425757D12F}" destId="{08F6EB28-75AD-4850-AAB7-B04C1DFF72DC}" srcOrd="0" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{F8E50B03-C5A0-41D8-A4CD-4BF30BFD3617}" type="presParOf" srcId="{08F6EB28-75AD-4850-AAB7-B04C1DFF72DC}" destId="{6FE0EDBB-C7E9-4A8C-A872-13084DA196BC}" srcOrd="0" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{22875B8E-C78A-491B-B361-85B064AD6B2F}" type="presParOf" srcId="{6FE0EDBB-C7E9-4A8C-A872-13084DA196BC}" destId="{E80E6BD4-B243-45F8-8674-F2FF8DD91C50}" srcOrd="0" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{AE41C528-D054-4D0F-BC56-00513E76A835}" type="presParOf" srcId="{E80E6BD4-B243-45F8-8674-F2FF8DD91C50}" destId="{095A698B-B03C-4AB8-89FB-D069EA405182}" srcOrd="0" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{0CAC7FBB-4FCC-4C31-8DDB-75D4FF020F3A}" type="presParOf" srcId="{E80E6BD4-B243-45F8-8674-F2FF8DD91C50}" destId="{16CC9F8E-6CF4-4834-93AB-676B9823962F}" srcOrd="1" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{81DD28E5-6B39-4219-BE68-06D32851B88A}" type="presParOf" srcId="{E80E6BD4-B243-45F8-8674-F2FF8DD91C50}" destId="{B1F82AB7-F600-4F0F-A819-0E13DB3F39A5}" srcOrd="2" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{728308AD-00D4-470B-BCA6-1B0433E6B6C3}" type="presParOf" srcId="{E80E6BD4-B243-45F8-8674-F2FF8DD91C50}" destId="{AEF027AF-ADD4-41C2-AC2B-13FEDE32C415}" srcOrd="3" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{1D139609-24D3-4143-95B0-3584780F46B0}" type="presParOf" srcId="{6FE0EDBB-C7E9-4A8C-A872-13084DA196BC}" destId="{D41980AA-D309-43F0-BF58-012F2E3D583A}" srcOrd="1" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{01C332E3-27A2-462E-B14B-8C3D416E54F4}" type="presParOf" srcId="{6FE0EDBB-C7E9-4A8C-A872-13084DA196BC}" destId="{C0587850-10BA-48AC-9C96-F2E8DDB81A9C}" srcOrd="2" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{8162F157-AABD-49AD-BD95-2D701CB9B8DC}" type="presParOf" srcId="{C0587850-10BA-48AC-9C96-F2E8DDB81A9C}" destId="{51DE7F31-6056-41CF-A1F8-5E4E6F252F69}" srcOrd="0" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{BAAFA36C-E721-488E-92FB-64E1A52226E5}" type="presParOf" srcId="{6FE0EDBB-C7E9-4A8C-A872-13084DA196BC}" destId="{53F8E7B3-14F1-47DB-8D1A-02FE4CCB21A0}" srcOrd="3" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{A0CC870B-7A48-4869-8682-B6F4CE0C025A}" type="presParOf" srcId="{6FE0EDBB-C7E9-4A8C-A872-13084DA196BC}" destId="{7CCDD84D-8793-46A5-97DD-F61AD62325F9}" srcOrd="4" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{584BA6DD-2531-48B5-A540-40CB102C2360}" type="presParOf" srcId="{7CCDD84D-8793-46A5-97DD-F61AD62325F9}" destId="{FB3CBAC5-6093-4CB4-AF8F-E7B57FB40A72}" srcOrd="0" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{5F2DD8CD-58A5-4327-AB5F-19804D01C4F2}" type="presParOf" srcId="{6FE0EDBB-C7E9-4A8C-A872-13084DA196BC}" destId="{FFD3804D-110E-4588-A985-472E18ED558D}" srcOrd="5" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{E5806161-AE73-4965-AEB2-DC525D965B99}" type="presParOf" srcId="{6FE0EDBB-C7E9-4A8C-A872-13084DA196BC}" destId="{D8E95FD7-3C8F-4AD2-B6A0-3B58091DB0D0}" srcOrd="6" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
            <dgm:cxn modelId="{A8E23FD6-A108-42FB-8935-BEA88C74FF1A}" type="presParOf" srcId="{D8E95FD7-3C8F-4AD2-B6A0-3B58091DB0D0}" destId="{8ECB4450-30D8-4309-B2D8-B5E9CFB2B24D}" srcOrd="0" destOrd="0" presId="urn:microsoft.com/office/officeart/2008/layout/VerticalCurvedList"/>
        </dgm:cxnLst>
        <dgm:bg/>
        <dgm:whole/>
        <dgm:extLst>
            <a:ext uri="http://schemas.microsoft.com/office/drawing/2008/diagram">
                <dsp:dataModelExt 
                    xmlns:dsp="http://schemas.microsoft.com/office/drawing/2008/diagram" relId="rId10" minVer="http://schemas.openxmlformats.org/drawingml/2006/diagram"/>
            </a:ext>
        </dgm:extLst>
    </dgm:dataModel>

以下是尝试从其xml文件

解析CTDataModel的代码
import org.openxmlformats.schemas.drawingml.x2006.diagram.CTDataModel;
import org.openxmlformats.schemas.drawingml.x2006.diagram.CTPtList;

String file = "/Users/xyz/Documents/testppt/ppt/diagrams/data1.xml";
CTDataModel dataModel = CTDataModel.Factory.parse(new FileInputStream(file));
CTPtList ptLst = dataModel.getPtLst();

上面的代码总是在ptLst中返回null。

Apache POI 3.13包含

The Apache POI 3.13 library contains

如果还有其他方式可以实施,请告诉我。

1 个答案:

答案 0 :(得分:4)

使用XMLBeans解析xml元素(由Apache POI用作xml映射层时),需要查找该xml元素的相应父元素。

对于Office Open XML容器内的xml文件(.xlsx,.pptx,.docx是zip文件),您通常会在poi-ooxml-schemas(简化版)中找到...文档类或ooxml-schemas(完整版)
只需在(二进制)jar中搜索CT<capitalized element name>个匹配项 - 因此在您的情况下dgm:dataModel变为CTDataModel,但您需要搜索引用该类的类,而不是使用CTDataModel类。
在您的情况下,DataModelDocument是封闭类,但这也适用于中间xml类型(没有...Document命名)。

请注意某些类型名称(如CTShape)将位于多个包中,这反映了xml命名空间 - 因此当然您需要使用正确的命名空间...