mf.org.apache.xerces.impl.xs.traversers.XSDHandler
used to identify a reference to a schema document if the same document is referenced twice with the same key, then we only need to parse it once. When 2 XSDKey's are compared, the following table can be used to determine whether they are equal: inc red imp pre ins inc N/L ? N/L N/L N/L red ? N/L ? ? ? imp N/L ? N/P N/P N/P pre N/L ? N/P N/P N/P ins N/L ? N/P N/P N/P Where: N/L: duplicate when they have the same namespace and location. ? : not clear from the spec. REVISIT: to simplify the process, also considering it's very rare, we treat them as not duplicate. N/P: not possible. imp/pre/ins are referenced by namespace. when the first time we encounter a schema document for a namespace, we create a grammar and store it in the grammar bucket. when we see another reference to the same namespace, we first check whether a grammar with the same namespace is already in the bucket, which is true in this case, so we won't create another XSDKey. Conclusion from the table: two XSDKey's are duplicate only when all of the following are true: 1. They are both "redefine", or neither is "redefine"; 2. They have the same namespace; 3. They have the same non-null location. About 3: if neither has a non-null location, then it's the case where 2 input streams are provided, but no system ID is provided. We can't tell whether the 2 streams have the same content, so we treat them as not duplicate.