You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Neil de Hoog <ne...@lunatech.com> on 2000/08/08 10:20:27 UTC

bugs in SimpleContentmodel and MixedContentModel

I have here two patches. One for SimpleContentModel and one for
MixedContentModel. Previously I already sent a patch to the list but
nothing was done with it (no response and it was not included). I really
would like to get at least a response even if it is only 'your code will
not be included'.

In SimpleContentModel the start of whatCanGoHere is like this:

        for (int index = info.insertAt; index < info.childCount;
index++) {
          info.curChildren[index].setValues(info.curChildren[index+1]);
        }

I think this code has two errors. First it changes the values of the
curChildren while you only need to shift the reference and second it
continues for to long. I think this version is better:

        for (int index = info.insertAt; index < info.childCount-1;
index++) {
          info.curChildren[index] = info.curChildren[index+1];
        }


In MixedContentModel, also in whatCanGoHere the for loop at the
beginning suffers from the same loop problem so I think this line is
better:

        for (int index = info.insertAt; index < info.childCount-1;
index++)

close at the bottom of this same function you will find:

        if (fullyValid && (failedIndex < info.childCount))
            bStatus = false;

I think this is wrong because if failedIndex equals -1 it means the
element is valid. I think it would be better to write:

        if (fullyValid && (failedIndex != -1))
            bStatus = false;

Neil de Hoog
-- 

Neil de Hoog

neil@lunatech.com
neil@v2.nl