/** * Sets the value of the tag property. * * @param value * allowed object is * {@link SdtPr.Tag } * */ public void setTag(Tag value) { Tag existingTag = getTag(); if (existingTag!=null) { if (!existingTag.equals(value)) { rPrOrAliasOrLock.remove(existingTag); if (value==null) { log.debug("Changing SDT tag from " + existingTag.getVal() + " to null"); } else { log.debug("Changing SDT tag from " + existingTag.getVal() + " to " + value.getVal() ); rPrOrAliasOrLock.add(value); } } // else - they are the same, so do nothing } else if (value!=null) { //ObjectFactory factory = new ObjectFactory(); //JAXBElement idWrapper = factory.createSdtPrId(value); rPrOrAliasOrLock.add(value); } }
private void emptyRepeatTagValue(final Tag tag) { if (tag==null) { // TODO: this is ok for a w15 repeat log.warn("No tag"); return; } final String tagVal = tag.getVal(); final Pattern stripRepeatArgPattern = Pattern .compile("(.*od:repeat=)([^&]*)(.*)"); final Matcher stripPatternMatcher = stripRepeatArgPattern .matcher(tagVal); if (!stripPatternMatcher.matches()) { log.error("Cannot find repeat tag in sdtPr/tag while processing repeat; something is wrong with " + tagVal); return; } // final String emptyRepeatValue = stripPatternMatcher.group(1) // + stripPatternMatcher.group(3); final String emptyRepeatValue = BINDING_RESULT_RPTD + "=" + stripPatternMatcher.group(2) + stripPatternMatcher.group(3); tag.setVal(emptyRepeatValue); }
private void processDescendantCondition(Object sdt, String xpathBase, int index, Tag tag ) { Condition c = null; HashMap<String, String> map = QueryString.parseQueryString( tag.getVal(), true); String conditionId = map.get(BINDING_ROLE_CONDITIONAL); if (conditionId != null) { //c = ConditionsPart.getConditionById(conditions, conditionId); c = conditionsMap.get(conditionId); if (c == null) { log.error("Missing condition " + conditionId); throw new InputIntegrityException("Required condition '" + conditionId + "' is missing"); } // TODO: this code assumes the condition contains // a simple xpath if(log.isDebugEnabled()) { log.debug("Using condition" + XmlUtils.marshaltoString(c, true, true)); } Condition newCondition = c.repeat(xpathBase, index, conditionsMap, xpathsMap); // set sdt to use it map.put(BINDING_ROLE_CONDITIONAL, newCondition.getId() ); tag.setVal(QueryString.create(map)); } }
if (replacement==null) { log.error( OpenDoPEHandler.getSdtPr(entry).getTag().getVal() + " - No replacement SDT with ID " + key.toString() );
/** * Workaround for the fact that Xalan doesn't let us pass an AtomicInteger into an extension * function. Instead, it converts it into an int, which means the object in our * bookmarkIdCounter parameter isn't updated. * * So here we wrap the AtomicInteger in a class, * * @author jharrop * */ public static class BookmarkCounter { protected AtomicInteger bookmarkId; BookmarkCounter(AtomicInteger bookmarkId) { this.bookmarkId = bookmarkId; } }
private List<Object> processOpenDopeRepeat(Object sdt, Map<String, CustomXmlPart> customXmlDataStorageParts) { Tag tag = getSdtPr(sdt).getTag(); HashMap<String, String> map = QueryString.parseQueryString( tag.getVal(), true); String repeatId = map.get(BINDING_ROLE_REPEAT); // Check, whether we are in an old repeat case. These can be removed. if (StringUtils.isEmpty(repeatId)) return new ArrayList<Object>(); org.opendope.xpaths.Xpaths.Xpath xpathObj = xpathsMap.get(repeatId); if (xpathObj==null) { log.error("repeat " + repeatId + " is missing from xpaths"); throw new RuntimeException("repeat " + repeatId + " is missing from xpaths"); } String storeItemId = xpathObj.getDataBinding().getStoreItemID(); String xpath = xpathObj.getDataBinding().getXpath(); String prefixMappings = xpathObj.getDataBinding().getPrefixMappings(); try { return processRepeat(sdt, customXmlDataStorageParts, storeItemId, xpath, prefixMappings, false); } catch (W15RepeatZeroException w15) { // won't happen in this case return null; } }
log.debug("no tag " + XmlUtils.marshaltoString(parentUnwrapped)); } else { HashMap<String, String> map = QueryString.parseQueryString(tag.getVal(), true); String repeatId = map.get(OpenDoPEHandler.BINDING_ROLE_REPEAT); if (repeatId!=null) {
final String tagVal = tag.getVal(); final Pattern stripConditionArgPattern = Pattern .compile("(.*od:condition=)([^&]*)(.*)");
final String tagVal = tag.getVal(); final Pattern stripRepeatArgPattern = Pattern .compile("(.*od:repeat=)([^&]*)(.*)");
= QueryString.parseQueryString(sdtPr.getTag().getVal(), true);
map = QueryString.parseQueryString(tag.getVal(), true);
if (tag!=null) { map = QueryString.parseQueryString( tag.getVal(), true);
String tag = sdtPr.getTag().getVal();
HashMap<String, String> map = QueryString.parseQueryString(tag.getVal(), true); String xpathId= map.get(OpenDoPEHandler.BINDING_ROLE_XPATH);