sandygao 2003/01/16 15:59:04
Modified: java/src/org/apache/xerces/impl/xs SchemaGrammar.java
XSModelImpl.java
Log:
Include the schema for the schema namespace in XSModel.
Types from the schema namespace are by definition present in every
schema document, so they should be included in XSModel.
Revision Changes Path
1.28 +9 -2 xml-xerces/java/src/org/apache/xerces/impl/xs/SchemaGrammar.java
Index: SchemaGrammar.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/SchemaGrammar.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- SchemaGrammar.java 14 Jan 2003 20:21:45 -0000 1.27
+++ SchemaGrammar.java 16 Jan 2003 23:59:03 -0000 1.28
@@ -145,8 +145,15 @@
fGlobalElemDecls = new SymbolHash();
fGlobalGroupDecls = new SymbolHash();
fGlobalNotationDecls = new SymbolHash();
- fGlobalTypeDecls = new SymbolHash();
fGlobalIDConstraintDecls = new SymbolHash();
+
+ // if we are parsing S4S, put built-in types in first
+ // they might get overwritten by the types from S4S, but that's
+ // considered what the application wants to do.
+ if (fTargetNamespace == SchemaSymbols.URI_SCHEMAFORSCHEMA)
+ fGlobalTypeDecls = SG_SchemaNS.fGlobalTypeDecls.makeClone();
+ else
+ fGlobalTypeDecls = new SymbolHash();
} // <init>(String, XSDDescription)
// number of built-in XSTypes we need to create for base and full
1.7 +11 -3 xml-xerces/java/src/org/apache/xerces/impl/xs/XSModelImpl.java
Index: XSModelImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XSModelImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XSModelImpl.java 14 Jan 2003 20:21:45 -0000 1.6
+++ XSModelImpl.java 16 Jan 2003 23:59:04 -0000 1.7
@@ -149,11 +149,19 @@
public XSModelImpl(SchemaGrammar[] grammars) {
// copy namespaces/grammars from the array to our arrays
int len = grammars.length;
- fNamespaces = new String[Math.max(len, 5)];
- fGrammarList = new SchemaGrammar[Math.max(len, 5)];
+ fNamespaces = new String[Math.max(len+1, 5)];
+ fGrammarList = new SchemaGrammar[Math.max(len+1, 5)];
+ boolean hasS4S = false;
for (int i = 0; i < len; i++) {
fNamespaces[i] = grammars[i].getTargetNamespace();
fGrammarList[i] = grammars[i];
+ if (fNamespaces[i] == SchemaSymbols.URI_SCHEMAFORSCHEMA)
+ hasS4S = true;
+ }
+ // If a schema for the schema namespace isn't included, include it here.
+ if (!hasS4S) {
+ fNamespaces[len] = SchemaSymbols.URI_SCHEMAFORSCHEMA;
+ fGrammarList[len++] = SchemaGrammar.SG_SchemaNS;
}
SchemaGrammar sg1, sg2;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]