// We need to lookup the XPaths part.
// In principle, that part should be identical in both
// openDopePkg and instancePkg.
// We'll get it from instancePkg
XPathsPart xPathsPart = ((WordprocessingMLPackage)instancePkg).getMainDocumentPart().getXPathsPart();
if ( xPathsPart==null) {
throw new Docx4JException("OpenDoPE XPaths part missing");
}
for ( Object entry : instanceSdtPrFinder.boundSdtPotentialRepair ) {
// If the SDT was made to contain a w:hyperlink, we had to remove:
// <w:dataBinding w:storeItemID="{5448916C-134B-45E6-B8FE-88CC1FFC17C3}" w:xpath="/myxml[1]/element2[1]" w:prefixMappings=""/>
// <w:text w:multiLine="true"/>
// Now we need to add those back in
SdtElement sdt = (SdtElement)entry;
SdtPr sdtPr = sdt.getSdtPr();
if (sdtPr.getDataBinding()==null ) {
// Identify xpathId
Tag tag = sdtPr.getTag();
HashMap<String, String> map = QueryString.parseQueryString(tag.getVal(), true);
String xpathId= map.get(OpenDoPEHandler.BINDING_ROLE_XPATH);
// Look up - throws InputIntegrityException if not found
Xpath xp = xPathsPart.getXPathById(xpathId);
// Create object for dataBinding
CTDataBinding databinding = Context.getWmlObjectFactory().createCTDataBinding();
sdtPr.setDataBinding(databinding);
databinding.setXpath( xp.getDataBinding().getXpath());