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/06/25 07:26:58 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/parsers StandardParserConfiguration.java
andyc 01/06/24 22:26:58
Modified: java/src/org/apache/xerces/impl Tag: xerces_j_2
Constants.java XMLDocumentScanner.java
java/src/org/apache/xerces/parsers Tag: xerces_j_2
StandardParserConfiguration.java
Log:
Fixed discrepency between Xerces2 and Xerces 1.x code base -- X2
wasn't reporting the boundaries of the five built-in entities
(e.g. &, etc). Added a feature to allow user to turn it off
but it is on by default for backwards compatibility.
Revision Changes Path
No revision
No revision
1.1.2.7 +5 -2 xml-xerces/java/src/org/apache/xerces/impl/Attic/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/Attic/Constants.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- Constants.java 2001/04/07 02:41:54 1.1.2.6
+++ Constants.java 2001/06/25 05:26:53 1.1.2.7
@@ -65,7 +65,7 @@
*
* @author Andy Clark, IBM
*
- * @version $Id: Constants.java,v 1.1.2.6 2001/04/07 02:41:54 lehors Exp $
+ * @version $Id: Constants.java,v 1.1.2.7 2001/06/25 05:26:53 andyc Exp $
*/
public final class Constants {
@@ -163,8 +163,11 @@
/** Validate datatypes feature ("validation/validate-datatypes"). */
public static final String VALIDATE_DATATYPES_FEATURE = "validation/validate-datatypes";
- /** Should scanner resolve character deferences? */
+ /** Notify character references feature (scanner/notify-char-refs"). */
public static final String NOTIFY_CHAR_REFS_FEATURE = "scanner/notify-char-refs";
+
+ /** Notify built-in (&, etc.) references feature (scanner/notify-builtin-refs"). */
+ public static final String NOTIFY_BUILTIN_REFS_FEATURE = "scanner/notify-builtin-refs";
// xerces properties
1.1.2.88 +25 -7 xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLDocumentScanner.java
Index: XMLDocumentScanner.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLDocumentScanner.java,v
retrieving revision 1.1.2.87
retrieving revision 1.1.2.88
diff -u -r1.1.2.87 -r1.1.2.88
--- XMLDocumentScanner.java 2001/05/09 07:20:24 1.1.2.87
+++ XMLDocumentScanner.java 2001/06/25 05:26:54 1.1.2.88
@@ -104,7 +104,7 @@
* @author Arnaud Le Hors, IBM
* @author Eric Ye, IBM
*
- * @version $Id: XMLDocumentScanner.java,v 1.1.2.87 2001/05/09 07:20:24 andyc Exp $
+ * @version $Id: XMLDocumentScanner.java,v 1.1.2.88 2001/06/25 05:26:54 andyc Exp $
*/
public class XMLDocumentScanner
extends XMLScanner
@@ -177,6 +177,10 @@
protected static final String LOAD_EXTERNAL_DTD =
Constants.XERCES_FEATURE_PREFIX + Constants.LOAD_EXTERNAL_DTD_FEATURE;
+ /** Feature identifier: notify built-in refereces. */
+ protected static final String NOTIFY_BUILTIN_REFS =
+ Constants.XERCES_FEATURE_PREFIX + Constants.NOTIFY_BUILTIN_REFS_FEATURE;
+
// property identifiers
/** Property identifier: DTD scanner. */
@@ -187,7 +191,11 @@
/** Recognized features. */
private static final String[] RECOGNIZED_FEATURES = {
- NOTIFY_CHAR_REFS, VALIDATION, NAMESPACES, LOAD_EXTERNAL_DTD,
+ VALIDATION,
+ NAMESPACES,
+ LOAD_EXTERNAL_DTD,
+ NOTIFY_CHAR_REFS,
+ NOTIFY_BUILTIN_REFS,
};
/** Recognized properties. */
@@ -261,6 +269,9 @@
protected boolean fLoadExternalDTD = true;
+ /** Notify built-in references. */
+ protected boolean fNotifyBuiltInRefs = true;
+
// dispatchers
/** Active dispatcher. */
@@ -369,6 +380,9 @@
fNamespaces = componentManager.getFeature(NAMESPACES);
fAttributes.setNamespaces(fNamespaces);
+ // xerces features
+ fNotifyCharRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS);
+
// xerces properties
fDTDScanner = (XMLDTDScanner)componentManager.getProperty(DTD_SCANNER);
@@ -383,7 +397,7 @@
fStandalone = false;
fScanningDTD = false;
- // save built-in entity names
+ // create symbols
fCDATASymbol = fSymbolTable.addSymbol("CDATA");
// setup dispatcher
@@ -426,9 +440,13 @@
String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
if (feature.equals(Constants.LOAD_EXTERNAL_DTD_FEATURE)) {
fLoadExternalDTD = state;
+ return;
}
- return;
+ if (feature.equals(Constants.NOTIFY_BUILTIN_REFS_FEATURE)) {
+ fNotifyCharRefs = state;
+ }
}
+
} // setFeature(String,boolean)
/**
@@ -1152,7 +1170,7 @@
*/
private void handleCharacter(char c, String entity) throws XNIException {
if (fDocumentHandler != null) {
- if (fNotifyCharRefs) {
+ if (fNotifyBuiltInRefs) {
fDocumentHandler.startEntity(entity, null, null, null);
}
@@ -1160,9 +1178,9 @@
fString.setValues(fSingleChar, 0, 1);
fDocumentHandler.characters(fString);
- if (fNotifyCharRefs) {
+ if (fNotifyBuiltInRefs) {
fDocumentHandler.endEntity(entity);
- }
+ }
}
} // handleCharacter(char)
No revision
No revision
1.1.2.10 +7 -2 xml-xerces/java/src/org/apache/xerces/parsers/Attic/StandardParserConfiguration.java
Index: StandardParserConfiguration.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Attic/StandardParserConfiguration.java,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -r1.1.2.9 -r1.1.2.10
--- StandardParserConfiguration.java 2001/05/09 07:20:47 1.1.2.9
+++ StandardParserConfiguration.java 2001/06/25 05:26:57 1.1.2.10
@@ -111,7 +111,7 @@
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
*
- * @version $Id: StandardParserConfiguration.java,v 1.1.2.9 2001/05/09 07:20:47 andyc Exp $
+ * @version $Id: StandardParserConfiguration.java,v 1.1.2.10 2001/06/25 05:26:57 andyc Exp $
*/
public class StandardParserConfiguration
extends BasicParserConfiguration {
@@ -142,6 +142,10 @@
protected static final String LOAD_EXTERNAL_DTD =
Constants.XERCES_FEATURE_PREFIX + Constants.LOAD_EXTERNAL_DTD_FEATURE;
+ /** Feature identifier: notify built-in refereces. */
+ protected static final String NOTIFY_BUILTIN_REFS =
+ Constants.XERCES_FEATURE_PREFIX + Constants.NOTIFY_BUILTIN_REFS_FEATURE;
+
// property identifiers
/** Property identifier: error reporter. */
@@ -253,7 +257,7 @@
final String[] recognizedFeatures = {
WARN_ON_DUPLICATE_ATTDEF, WARN_ON_UNDECLARED_ELEMDEF,
ALLOW_JAVA_ENCODINGS, CONTINUE_AFTER_FATAL_ERROR,
- LOAD_EXTERNAL_DTD,
+ LOAD_EXTERNAL_DTD, NOTIFY_BUILTIN_REFS,
};
addRecognizedFeatures(recognizedFeatures);
@@ -263,6 +267,7 @@
fFeatures.put(ALLOW_JAVA_ENCODINGS, Boolean.FALSE);
fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE);
fFeatures.put(LOAD_EXTERNAL_DTD, Boolean.TRUE);
+ fFeatures.put(NOTIFY_BUILTIN_REFS, Boolean.TRUE);
// add default recognized properties
final String[] recognizedProperties = {
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org