You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Sandeep Randhawa <sa...@glide.net.in> on 2001/07/01 09:34:56 UTC
SimpleContentModel Bug
Hi,
I would like to report a couple of bugs.
1. org.apache.xcerces.validators.common.SimpleContentModel.
Method: whatCanGoHere(boolean fullyValid, InsertableElementsInfo info)
throws Exception
Code:
for (int index = info.insertAt; index < info.childCount; index++) {
info.curChildren[index].setValues(info.curChildren[index+1]);
}
info.childCount--;
Should be:
if(info.insertAt < info.childCount){
for (int index = info.insertAt; index < info.childCount;
index++) {
info.curChildren[index].setValues(info.curChildren[index+1]);
}
info.childCount--;
}
Reason is following. eg. <html> has two child options <head> and <body>. In
the case that <head> is already present as a child of <html> following
alreadyChildren are passed in: <head><null> where info.insertAt is 1.
Since, info.insertAt is not less than info.childCount, both are 1. The buggy
code dosen't go into the for loop, but still decrements info.childCount,
leading to aberrant result. So, only in the case that info.insertAt is less
than info.childCount should the childCount be decremented.
2. DFAContentModel
For some reason(I din't go too much in detail) in the same method as above.
if (fElemMap[elemIndex].uri == curElem.uri &&
fElemMap[elemIndex].localpart == curElem.localpart)
fElemMap[elemIndex].localpart actually points to the Qname's rawname.
That is somewhere QName.localpart and QName.rawname have been exchanged. You
may try this by passing in the StringPool and looking at what it prints out.
Also, is there some standard interface for accessing whatCanGoHere(). Right
now the way I do it, is to instantiate the Grammar using
MLDTDScanner( haven't worked on schema yet) and then call the methods on it.
But I have to retain all the QName's as are reported by XMLDTDScanner in a
Map and get the QName's using a call to get(key).
If there is not. I was wondering if one could be made. Since, I don't know a
lot about xerces maybe someone could write a skeleton code and I'll attempt
to do the rest. Also, could you please fix the above bugs in the next
version. I did report the bugs on bugzilla 1764 Bug filed xerces, but
apparently nobody looked it up, before releasing the next version.
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org