fElemMap = new QName[fLeafCount];
fElemMapType = new int[fLeafCount];
fElemMapSize = 0;
for (int outIndex = 0; outIndex < fLeafCount; outIndex++)
{
fElemMap[outIndex] = new QName();
if ( (fLeafListType[outIndex] & 0x0f) != 0 ) {
if (fLeafNameTypeVector == null) {
fLeafNameTypeVector = new ContentLeafNameTypeVector();
}
}
// Get the current leaf's element index
final QName element = fLeafList[outIndex].getElement();
// See if the current leaf node's element index is in the list
int inIndex = 0;
for (; inIndex < fElemMapSize; inIndex++)
{
if (fDTD) {
if (fElemMap[inIndex].rawname == element.rawname) {
break;
}
}
else {
if (fElemMapType[inIndex] == fLeafListType[outIndex] &&
fElemMap[inIndex].uri == element.uri &&
fElemMap[inIndex].localpart == element.localpart)
break;
}
}
// If it was not in the list, then add it, if not the EOC node
if (inIndex == fElemMapSize) {
//if (fDTD) {
// fElemMap[fElemMapSize].setValues(-1, element.rawname, element.rawname, -1);
//}
//else {
fElemMap[fElemMapSize].setValues(element);
//}
fElemMapType[fElemMapSize] = fLeafListType[outIndex];
fElemMapSize++;
}
}
// set up the fLeafNameTypeVector object if there is one.
if (fLeafNameTypeVector != null) {
fLeafNameTypeVector.setValues(fElemMap, fElemMapType, fElemMapSize);
}
/***
* Optimization(Jan, 2001); We sort fLeafList according to
* elemIndex which is *uniquely* associated to each leaf.
* We are *assuming* that each element appears in at least one leaf.
**/
int[] fLeafSorter = new int[fLeafCount + fElemMapSize];
int fSortCount = 0;
for (int elemIndex = 0; elemIndex < fElemMapSize; elemIndex++) {
for (int leafIndex = 0; leafIndex < fLeafCount; leafIndex++) {
final QName leaf = fLeafList[leafIndex].getElement();
final int leafType = fLeafListType[leafIndex];
final QName element = fElemMap[elemIndex];
if (fDTD) {
if (leaf.rawname == element.rawname) {
fLeafSorter[fSortCount++] = leafIndex;
}
}