public boolean putGrammar(SchemaGrammar grammar,boolean deep,boolean ignoreConflict){
  if (!ignoreConflict) {
    return putGrammar(grammar,deep);
  }
  SchemaGrammar sg=getGrammar(grammar.fTargetNamespace);
  if (sg == null) {
    putGrammar(grammar);
  }
  if (!deep) {
    return true;
  }
  Vector currGrammars=grammar.getImportedGrammars();
  if (currGrammars == null) {
    return true;
  }
  Vector grammars=((Vector)currGrammars.clone());
  SchemaGrammar sg1, sg2;
  Vector gs;
  for (int i=0; i < grammars.size(); i++) {
    sg1=(SchemaGrammar)grammars.elementAt(i);
    sg2=getGrammar(sg1.fTargetNamespace);
    if (sg2 == null) {
      gs=sg1.getImportedGrammars();
      if (gs == null)       continue;
      for (int j=gs.size() - 1; j >= 0; j--) {
        sg2=(SchemaGrammar)gs.elementAt(j);
        if (!grammars.contains(sg2))         grammars.addElement(sg2);
      }
    }
 else {
      grammars.remove(sg1);
    }
  }
  for (int i=grammars.size() - 1; i >= 0; i--) {
    putGrammar((SchemaGrammar)grammars.elementAt(i));
  }
  return true;
}

public boolean putGrammar ( SchemaGrammar grammar , boolean deep , boolean ignoreConflict ) { if ( ! ignoreConflict ) { return putGrammar ( grammar , deep ) ; } SchemaGrammar sg = getGrammar ( grammar . fTargetNamespace ) ; if ( sg == null ) { putGrammar ( grammar ) ; } if ( ! deep ) { return true ; } Vector currGrammars = grammar . getImportedGrammars ( ) ; if ( currGrammars == null ) { return true ; } Vector grammars = ( ( Vector ) currGrammars . clone ( ) ) ; SchemaGrammar sg1 , sg2 ; Vector gs ; for ( int i = 0 ; i < grammars . size ( ) ; i ++ ) { sg1 = ( SchemaGrammar ) grammars . elementAt ( i ) ; sg2 = getGrammar ( sg1 . fTargetNamespace ) ; if ( sg2 == null ) { gs = sg1 . getImportedGrammars ( ) ; if ( gs == null ) continue ; for ( int j = gs . size ( ) - 1 ; j >= 0 ; j -- ) { sg2 = ( SchemaGrammar ) gs . elementAt ( j ) ; if ( ! grammars . contains ( sg2 ) ) grammars . addElement ( sg2 ) ; } } else { grammars . remove ( sg1 ) ; } } for ( int i = grammars . size ( ) - 1 ; i >= 0 ; i -- ) { putGrammar ( ( SchemaGrammar ) grammars . elementAt ( i ) ) ; } return true ; }
put a schema grammar and any grammars imported by it ( directly or inderectly ) into the registry . when a grammar with the same target namespace is already in the bucket , and different from the one being added , no grammar will be added into the bucket .
