question: public boolean equals ( XMLGrammarDescription desc1 , XMLGrammarDescription desc2 ) { if ( desc1 instanceof XMLSchemaDescription ) { if ( ! ( desc2 instanceof XMLSchemaDescription ) ) { return false ; } final XMLSchemaDescription sd1 = ( XMLSchemaDescription ) desc1 ; final XMLSchemaDescription sd2 = ( XMLSchemaDescription ) desc2 ; final String targetNamespace = sd1 . getTargetNamespace ( ) ; if ( targetNamespace != null ) { if ( ! targetNamespace . equals ( sd2 . getTargetNamespace ( ) ) ) { return false ; } } else if ( sd2 . getTargetNamespace ( ) != null ) { return false ; } final String expandedSystemId = sd1 . getExpandedSystemId ( ) ; if ( expandedSystemId != null ) { if ( ! expandedSystemId . equals ( sd2 . getExpandedSystemId ( ) ) ) { return false ; } } else if ( sd2 . getExpandedSystemId ( ) != null ) { return false ; } return true ; } return desc1 . equals ( desc2 ) ; }
target:  This method checks whether two grammars are the same. Currently, we compare the root element names for DTD grammars and the target namespaces for Schema grammars. The application can override this behaviour and add its own logic.