[Logo] OLD FORUM - Use new one: https://www.CaptainCasa.online/forum
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
problem with contentReplace  XML
Forum Index -> Development
Author Message
moebus

Power User

Joined: 21/11/2007 12:49:18
Messages: 93
Offline

in some complex pages we have rowdynamic, using rowinclude, with the attribute contentReplace set to some value.

This is not rencered correctly, it passes through ROWINCLUDEComponent.removeDoubleReplacements(), where in our case the argument list contains two elements:

Code:
 
 #{d.:#{d.d_55.
 
 #{d.d55.Something:#{d.d55.SomethingElse
 
 


This method in question removes the first item since it is considered as double, but clearly it is not.

While it might be a good idea from performance point of view it is probably best to discard this method altogether (as seems to be done in RowIncludeComponent.initContentReplaceList()), since there are many complex scenarios where a simple string checking can be tricked by possible replacement settings, when one might be constructed to explicitly take into account the effects of a previous replacements.

Manfred
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5555
Offline

...the background of this method is not performance (this is done one time only when loading the page...) but really avoiding of logical double replacements...

We will have a closer look inside, but wiping out too fast is dangerous.
In the meantime please switch to ".Something.:.SomethingElse."...

Regards, Björn

Björn Müller, CaptainCasa GmbH
moebus

Power User

Joined: 21/11/2007 12:49:18
Messages: 93
Offline

using Something:SomethingElse was our first try, but we came upon the double replacement problem you mention. We then found some code handling double stuff containing if's about replacement string starting with #{d.

So it worked better the way described, and with some special codes we could even trick your removeDoubleReplacements method so currently the code is working (though with much pain).

But we might try Something:SomeElseThing, or even do some more refactoring and check if the PageBean stuff is useful for our problem.
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5555
Offline

Hi,

we now change the method to...:

Code:
         for (int i=0; i<replacementsArray.length-1; i++)
         {
             ValueManager.NameValue nvFrom = replacementsArray[i];
             for (int j=i+1; j<replacementsArray.length; j++)
             {
                 ValueManager.NameValue nvTo = replacementsArray[j];
                 if (nvTo.name.startsWith(nvFrom.name) &&  // #{d.:#{d.d_55.;#{d.XXX.;#{d.d_55.YYY. => must be removed
                     nvTo.value.startsWith(nvFrom.value) &&
                     (nvTo.name.startsWith(nvFrom.value) == false)) // #{d.:#{d.d_55.;#{d.d_55.XXX.:#{d.d_55.YYY. must not be removed
                 {
                     replacementsArray[i] = null;
                     removedItem = true;
                 }
             }
         }
 

...and do "some testing"...

We can make this available as hot fix this week only, there is no Monday update this week...


Regards, Björn

Björn Müller, CaptainCasa GmbH
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team