You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@apache.org on 2001/01/30 05:17:03 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/util NamespaceSupport.java
andyc 01/01/29 20:17:03
Modified: java/src/org/apache/xerces/impl Tag: xerces_j_2
XMLDTDScanner.java XMLValidator.java
java/src/org/apache/xerces/impl/validation Tag: xerces_j_2
Grammar.java
java/src/org/apache/xerces/impl/validation/grammars Tag:
xerces_j_2 DTDGrammar.java SchemaGrammar.java
java/src/org/apache/xerces/parsers Tag: xerces_j_2
SAXParser.java XMLDocumentParser.java
java/src/org/apache/xerces/util Tag: xerces_j_2
NamespaceSupport.java
Log:
Added updates for more work on identity constraints. Remaining
code will be ported from Xerces 1.x once validation is cleaned
up in Xerces2.
Revision Changes Path
No revision
No revision
1.1.2.77 +1 -17 xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLDTDScanner.java
Index: XMLDTDScanner.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLDTDScanner.java,v
retrieving revision 1.1.2.76
retrieving revision 1.1.2.77
diff -u -r1.1.2.76 -r1.1.2.77
--- XMLDTDScanner.java 2000/12/28 09:41:14 1.1.2.76
+++ XMLDTDScanner.java 2001/01/30 04:17:01 1.1.2.77
@@ -90,7 +90,7 @@
* @author Glenn Marcy, IBM
* @author Eric Ye, IBM
*
- * @version $Id: XMLDTDScanner.java,v 1.1.2.76 2000/12/28 09:41:14 andyc Exp $
+ * @version $Id: XMLDTDScanner.java,v 1.1.2.77 2001/01/30 04:17:01 andyc Exp $
*/
public class XMLDTDScanner
extends XMLScanner
@@ -133,9 +133,6 @@
/** fErrorReporter */
protected XMLErrorReporter fErrorReporter;
- /** fGrammarPool */
- protected GrammarPool fGrammarPool;
-
/** fDTDHandler */
protected XMLDTDHandler fDTDHandler;
@@ -330,9 +327,6 @@
// Xerces properties
- fGrammarPool = (GrammarPool)
- componentManager.getProperty(Constants.XERCES_PROPERTY_PREFIX
- + Constants.GRAMMAR_POOL_PROPERTY);
fErrorReporter = (XMLErrorReporter)
componentManager.getProperty(Constants.XERCES_PROPERTY_PREFIX
+ Constants.ERROR_REPORTER_PROPERTY);
@@ -375,16 +369,6 @@
throws SAXNotRecognizedException, SAXNotSupportedException {
super.setProperty(propertyId, value);
-
- // Xerces properties
- if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
- String property =
- propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
- if (property.equals(Constants.GRAMMAR_POOL_PROPERTY)) {
- fGrammarPool = (GrammarPool)value;
- }
- return;
- }
} // setProperty
1.1.2.63 +2 -2 xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLValidator.java
Index: XMLValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLValidator.java,v
retrieving revision 1.1.2.62
retrieving revision 1.1.2.63
diff -u -r1.1.2.62 -r1.1.2.63
--- XMLValidator.java 2001/01/05 06:30:21 1.1.2.62
+++ XMLValidator.java 2001/01/30 04:17:01 1.1.2.63
@@ -126,7 +126,7 @@
* @author Andy Clark, IBM
* @author Jeffrey Rodriguez IBM
*
- * @version $Id: XMLValidator.java,v 1.1.2.62 2001/01/05 06:30:21 andyc Exp $
+ * @version $Id: XMLValidator.java,v 1.1.2.63 2001/01/30 04:17:01 andyc Exp $
*/
public class XMLValidator
implements XMLComponent,
@@ -2736,7 +2736,7 @@
/** Factory method for creating a DTD grammar. */
protected DTDGrammar createDTDGrammar() {
- return new DTDGrammar();
+ return new DTDGrammar(fSymbolTable);
} // createDTDGrammar():DTDGrammar
} // class XMLValidator
No revision
No revision
1.1.2.31 +17 -5 xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/Grammar.java
Index: Grammar.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/Grammar.java,v
retrieving revision 1.1.2.30
retrieving revision 1.1.2.31
diff -u -r1.1.2.30 -r1.1.2.31
--- Grammar.java 2001/01/11 08:38:07 1.1.2.30
+++ Grammar.java 2001/01/30 04:17:02 1.1.2.31
@@ -57,9 +57,9 @@
package org.apache.xerces.impl.validation;
-import java.util.Hashtable;
import java.lang.Integer;
-import org.apache.xerces.xni.QName;
+import java.util.Hashtable;
+
import org.apache.xerces.impl.validation.XMLAttributeDecl;
import org.apache.xerces.impl.validation.XMLNotationDecl;
import org.apache.xerces.impl.validation.XMLEntityDecl;
@@ -72,7 +72,10 @@
import org.apache.xerces.impl.validation.models.DFAContentModel;
import org.apache.xerces.impl.validation.models.MixedContentModel;
import org.apache.xerces.impl.validation.models.SimpleContentModel;
+import org.apache.xerces.util.SymbolTable;
+import org.apache.xerces.xni.QName;
+
/**
* A generic grammar for use in validating XML documents. The Grammar
* object stores the validation information in a compiled form. Specific
@@ -92,7 +95,7 @@
* @author Eric Ye, IBM
* @author Andy Clark, IBM
*
- * @version $Id: Grammar.java,v 1.1.2.30 2001/01/11 08:38:07 andyc Exp $
+ * @version $Id: Grammar.java,v 1.1.2.31 2001/01/30 04:17:02 andyc Exp $
*/
public abstract class Grammar {
@@ -127,6 +130,9 @@
// Data
//
+ /** Symbol table. */
+ private SymbolTable fSymbolTable;
+
/** Target namespace of grammar. */
private String fTargetNamespace;
@@ -254,8 +260,9 @@
//
/** Default constructor. */
- protected Grammar() {
- } // <init>()
+ protected Grammar(SymbolTable symbolTable) {
+ fSymbolTable = symbolTable;
+ } // <init>(SymbolTable)
//
// Public methods
@@ -263,6 +270,11 @@
/** Returns true if this grammar is namespace aware. */
public abstract boolean isNamespaceAware();
+
+ /** Returns the symbol table. */
+ public SymbolTable getSymbolTable() {
+ return fSymbolTable;
+ } // getSymbolTable():SymbolTable
/** Returns this grammar's target namespace. */
public String getTargetNamespace() {
No revision
No revision
1.1.2.37 +6 -3 xml-xerces/java/src/org/apache/xerces/impl/validation/grammars/Attic/DTDGrammar.java
Index: DTDGrammar.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/grammars/Attic/DTDGrammar.java,v
retrieving revision 1.1.2.36
retrieving revision 1.1.2.37
diff -u -r1.1.2.36 -r1.1.2.37
--- DTDGrammar.java 2001/01/10 07:45:46 1.1.2.36
+++ DTDGrammar.java 2001/01/30 04:17:02 1.1.2.37
@@ -73,6 +73,8 @@
import org.apache.xerces.impl.validation.XMLContentSpec;
import org.apache.xerces.impl.validation.DatatypeValidator;
import org.apache.xerces.impl.validation.datatypes.DatatypeValidatorFactoryImpl;
+import org.apache.xerces.util.SymbolTable;
+
import org.apache.xerces.xni.QName;
import org.apache.xerces.xni.XMLString;
import org.apache.xerces.xni.XMLDTDContentModelHandler;
@@ -90,7 +92,7 @@
* @author Jeffrey Rodriguez, IBM
* @author Andy Clark, IBM
*
- * @version $Id: DTDGrammar.java,v 1.1.2.36 2001/01/10 07:45:46 andyc Exp $
+ * @version $Id: DTDGrammar.java,v 1.1.2.37 2001/01/30 04:17:02 andyc Exp $
*/
public class DTDGrammar
extends Grammar
@@ -206,9 +208,10 @@
//
/** Default constructor. */
- public DTDGrammar() {
+ public DTDGrammar(SymbolTable symbolTable) {
+ super(symbolTable);
setTargetNamespace("");
- } // <init>()
+ } // <init>(SymbolTable)
//
// Public methods
1.1.2.6 +8 -25 xml-xerces/java/src/org/apache/xerces/impl/validation/grammars/Attic/SchemaGrammar.java
Index: SchemaGrammar.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/grammars/Attic/SchemaGrammar.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- SchemaGrammar.java 2001/01/10 07:45:46 1.1.2.5
+++ SchemaGrammar.java 2001/01/30 04:17:02 1.1.2.6
@@ -59,14 +59,15 @@
import org.apache.xerces.impl.validation.Grammar;
import org.apache.xerces.impl.validation.GrammarPool;
-
-import org.apache.xerces.xni.QName;
import org.apache.xerces.impl.validation.XMLContentSpec;
import org.apache.xerces.impl.validation.DatatypeValidator;
import org.apache.xerces.impl.validation.datatypes.DatatypeValidatorFactoryImpl;
import org.apache.xerces.impl.validation.XMLAttributeDecl;
import org.apache.xerces.impl.validation.ContentModelValidator;
import org.apache.xerces.impl.validation.XMLElementDecl;
+import org.apache.xerces.util.SymbolTable;
+
+import org.apache.xerces.xni.QName;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -81,7 +82,7 @@
*
* @author ericye, IBM
* @author Stubs generated by DesignDoc on Mon Sep 11 11:10:57 PDT 2000
- * @version $Id: SchemaGrammar.java,v 1.1.2.5 2001/01/10 07:45:46 andyc Exp $
+ * @version $Id: SchemaGrammar.java,v 1.1.2.6 2001/01/30 04:17:02 andyc Exp $
*
*/
public class SchemaGrammar
@@ -139,28 +140,10 @@
// Constructors
//
- /**
- *
- */
- public SchemaGrammar() {
- }
-
- /**
- *
- *
- * @param grammarDocument
- */
- public SchemaGrammar(Document grammarDocument) {
- }
-
- /**
- *
- *
- * @param grammarDocument
- * @param grammarPool
- */
- public SchemaGrammar(Document grammarDocument, GrammarPool grammarPool) {
- }
+ /** Default constructor. */
+ public SchemaGrammar(SymbolTable symbolTable) {
+ super(symbolTable);
+ } // <init>(SymbolTable)
//
// Public methods
No revision
No revision
1.12.2.17 +2 -3 xml-xerces/java/src/org/apache/xerces/parsers/SAXParser.java
Index: SAXParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/SAXParser.java,v
retrieving revision 1.12.2.16
retrieving revision 1.12.2.17
diff -u -r1.12.2.16 -r1.12.2.17
--- SAXParser.java 2000/12/28 09:41:25 1.12.2.16
+++ SAXParser.java 2001/01/30 04:17:02 1.12.2.17
@@ -88,12 +88,11 @@
* @author Stubs generated by DesignDoc on Mon Sep 11 11:10:57 PDT 2000
* @author Andy Clark, IBM
*
- * @version $Id: SAXParser.java,v 1.12.2.16 2000/12/28 09:41:25 andyc Exp $
+ * @version $Id: SAXParser.java,v 1.12.2.17 2001/01/30 04:17:02 andyc Exp $
*/
public class SAXParser
extends XMLDocumentParser
- implements XMLDTDHandler, // XNI
- Parser, XMLReader // SAX1, SAX2
+ implements Parser, XMLReader // SAX1, SAX2
{
//
1.1.2.30 +9 -1 xml-xerces/java/src/org/apache/xerces/parsers/Attic/XMLDocumentParser.java
Index: XMLDocumentParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Attic/XMLDocumentParser.java,v
retrieving revision 1.1.2.29
retrieving revision 1.1.2.30
diff -u -r1.1.2.29 -r1.1.2.30
--- XMLDocumentParser.java 2001/01/05 09:33:27 1.1.2.29
+++ XMLDocumentParser.java 2001/01/30 04:17:02 1.1.2.30
@@ -94,7 +94,7 @@
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
*
- * @version $Id: XMLDocumentParser.java,v 1.1.2.29 2001/01/05 09:33:27 andyc Exp $
+ * @version $Id: XMLDocumentParser.java,v 1.1.2.30 2001/01/30 04:17:02 andyc Exp $
*/
public abstract class XMLDocumentParser
extends XMLParser
@@ -152,6 +152,14 @@
protected XMLDocumentParser() {
this(new SymbolTable(), new GrammarPool());
} // <init>()
+
+ /**
+ * Constructs a document parser using the specified symbol table
+ * and a default grammar pool.
+ */
+ protected XMLDocumentParser(SymbolTable symbolTable) {
+ this(symbolTable, new GrammarPool());
+ } // <init>(SymbolTable)
/**
* Constructor allowing to specify the symbol table and grammar pool
No revision
No revision
1.1.2.3 +22 -7 xml-xerces/java/src/org/apache/xerces/util/Attic/NamespaceSupport.java
Index: NamespaceSupport.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/util/Attic/NamespaceSupport.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- NamespaceSupport.java 2000/12/28 09:41:27 1.1.2.2
+++ NamespaceSupport.java 2001/01/30 04:17:03 1.1.2.3
@@ -67,7 +67,7 @@
*
* @author Andy Clark, IBM
*
- * @version $Id: NamespaceSupport.java,v 1.1.2.2 2000/12/28 09:41:27 andyc Exp $
+ * @version $Id: NamespaceSupport.java,v 1.1.2.3 2001/01/30 04:17:03 andyc Exp $
*/
public class NamespaceSupport
implements NamespaceContext {
@@ -109,14 +109,11 @@
// symbols
- /** Symbol: "". */
- private String fEmptySymbol;
-
/** Symbol: "xml". */
- private String fXmlSymbol;
+ protected String fXmlSymbol;
/** Symbol: "xmlns". */
- private String fXmlnsSymbol;
+ protected String fXmlnsSymbol;
//
// Constructors
@@ -126,6 +123,25 @@
public NamespaceSupport() {
} // <init>()
+ /**
+ * Constructs a namespace context object and initializes it with
+ * the prefixes declared in the specified context.
+ */
+ public NamespaceSupport(NamespaceContext context) {
+ while (context != null) {
+ int count = context.getDeclaredPrefixCount();
+ for (int i = 0; i < count; i++) {
+ String prefix = context.getDeclaredPrefixAt(i);
+ String uri = getURI(prefix);
+ if (uri == null) {
+ uri = context.getURI(prefix);
+ declarePrefix(prefix, uri);
+ }
+ }
+ context = context.getParentContext();
+ }
+ } // <init>(NamespaceContext)
+
//
// Public methods
//
@@ -141,7 +157,6 @@
public void reset(SymbolTable symbolTable) {
// save symbols
- fEmptySymbol = symbolTable.addSymbol("");
fXmlSymbol = symbolTable.addSymbol("xml");
fXmlnsSymbol = symbolTable.addSymbol("xmlns");