2016-11-25 97 views
0

我試圖以編程方式更新一些文本並更改基於openxml格式2006的演示文稿(.pptx)的SmartArt列表對象中的圖像。我成功地搜索並通過xml字符串上的replaceAll方法替換圖data1.xml文件中的文本,但我無法使用CTDataModel.Factory.parse(文件文件)方法解析CTDataModel文件無法使用Apache POI解析CTDataModel 3.13

下面是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

如果沒有實現,那麼請讓我知道任何其他方式。

+0

請嘗試DataModelDocument.Factory.parse( ...)而言,通常你不能用xml類型本身解析輸入數據,但是用封閉元素/類型 – kiwiwings

+0

@kiwiwings它工作,非常感謝!你可以發表你的評論作爲答案,以便我可以接受它。再次感謝。 – Arif

回答

4

當分析XMLBeans(由Apache POI用作xml映射圖層)的xml元素時,需要查找該xml元素的相應父元素。

對於Office Open XML容器內部的XML文件格式(.xlsx,.PPTX,.DOCX是zip文件),你通常會發現在poi-ooxml-schemas(縮版)一...文檔類或ooxml-schemas(完整版)
只需搜索(二進制)罐子的CT<capitalized element name>匹配 - 所以在你的情況下,dgm:dataModel變成CTDataModel,但不是使用CTDataModel類,你需要搜索引用該類的類。
在你的情況下,DataModelDocument是封閉類,但是這也適用於中間類型(不包括...Document命名)。

要知道,像CTShape某些類型名稱將在多個軟件包,它反映了XML命名空間 - 所以當然你需要使用正確的命名空間,然後...