// Get the part
// First we need to get the part. There are a few different ways to do this.
// If we know the itemId ..
String itemId = "{5448916C-134B-45E6-B8FE-88CC1FFC17C3}".toLowerCase();
CustomXmlDataStoragePart customXmlDataStoragePart = (CustomXmlDataStoragePart)wordMLPackage.getCustomXmlDataStorageParts().get(itemId);
// .. if you don't know the itemId (which you can get using ContentControlsPartsInfo),
// you could get the part by name, by type,
// or you could find the item Id by looking in an SDT for w:storeItemID:
// <w:sdt>
// <w:sdtPr>
// <w:dataBinding w:prefixMappings="" w:xpath="/myxml[1]/element1[1]"
// w:storeItemID="{5448916C-134B-45E6-B8FE-88CC1FFC17C3}"/>
// </w:sdtPr>
// <w:sdtContent>
// Get the contents
CustomXmlDataStorage customXmlDataStorage = customXmlDataStoragePart.getData();
// In a real program what you might do is populate this with your own data.
// You could replace the whole part (as is done in https://github.com/plutext/OpenDoPE-WAR/blob/master/webapp-simple/src/main/java/org/opendope/webapp/SubmitBoth.java ),
// or as we show below, just set some particular value