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...@locus.apache.org on 2000/10/26 18:56:25 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/impl XMLEntityManager.java XMLDocumentScanner.java XMLEntity.java
andyc 00/10/26 09:56:25
Modified: java/src/org/apache/xerces/impl Tag: xerces_j_2
XMLEntityManager.java XMLDocumentScanner.java
Removed: java/src/org/apache/xerces/impl Tag: xerces_j_2
XMLEntity.java
Log:
Removed the XMLEntity interface and its use in the document
scanner. At first, we thought that we needed some unique
identity to detect that we were still in markup at the end
of an entity but (at least for the document scanner) only a
boolean flag is needed. In the DTD scanner, a stack of
markup depth can be used for the same purpose. Either way,
we don't need XMLEntity so it's better to leave it out
until it's actually needed.
Revision Changes Path
No revision
No revision
1.1.2.41 +2 -17 xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLEntityManager.java
Index: XMLEntityManager.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLEntityManager.java,v
retrieving revision 1.1.2.40
retrieving revision 1.1.2.41
diff -u -r1.1.2.40 -r1.1.2.41
--- XMLEntityManager.java 2000/10/26 00:26:43 1.1.2.40
+++ XMLEntityManager.java 2000/10/26 16:56:20 1.1.2.41
@@ -114,7 +114,7 @@
* @author Stubs generated by DesignDoc on Mon Sep 18 18:23:16 PDT 2000
* @author Andy Clark, IBM
*
- * @version $Id: XMLEntityManager.java,v 1.1.2.40 2000/10/26 00:26:43 ericye Exp $
+ * @version $Id: XMLEntityManager.java,v 1.1.2.41 2000/10/26 16:56:20 andyc Exp $
*/
public class XMLEntityManager
implements XMLComponent {
@@ -546,11 +546,6 @@
return fEntityScanner;
} // getEntityScanner():XMLEntityScanner
- /** Returns the currently active entity. */
- public XMLEntity getCurrentEntity() {
- return fCurrentEntity;
- } // getCurrentEntity():XMLEntity
-
//
// XMLComponent methods
//
@@ -1121,8 +1116,7 @@
*
* @author Andy Clark, IBM
*/
- protected static abstract class Entity
- implements XMLEntity {
+ protected static abstract class Entity {
//
// Data
@@ -1161,15 +1155,6 @@
public void setValues(Entity entity) {
name = entity.name;
} // setValues(Entity)
-
- //
- // XMLEntity methods
- //
-
- /** Returns the name of the entity. */
- public String getName() {
- return name;
- } // getName():String
} // class Entity
1.1.2.47 +24 -24 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.46
retrieving revision 1.1.2.47
diff -u -r1.1.2.46 -r1.1.2.47
--- XMLDocumentScanner.java 2000/10/26 00:08:40 1.1.2.46
+++ XMLDocumentScanner.java 2000/10/26 16:56:21 1.1.2.47
@@ -101,7 +101,7 @@
* @author Stubs generated by DesignDoc on Mon Sep 11 11:10:57 PDT 2000
* @author Andy Clark, IBM
*
- * @version $Id: XMLDocumentScanner.java,v 1.1.2.46 2000/10/26 00:08:40 andyc Exp $
+ * @version $Id: XMLDocumentScanner.java,v 1.1.2.47 2000/10/26 16:56:21 andyc Exp $
*/
public class XMLDocumentScanner
extends XMLScanner
@@ -198,8 +198,8 @@
/** Entity depth. */
protected int fEntityDepth;
- /** The entity at the beginning of a piece of markup. */
- protected XMLEntity fMarkupEntity;
+ /** True if we started some markup. */
+ protected boolean fInMarkup;
/** Scanner state. */
protected int fScannerState;
@@ -362,7 +362,7 @@
// initialize vars
fEntityDepth = 0;
- fMarkupEntity = null;
+ fInMarkup = false;
fElementDepth = 0;
fCurrentElement = null;
fElementStack.clear();
@@ -511,8 +511,8 @@
}
// make sure markup is properly balanced
- if (fMarkupEntity != null) {
- fMarkupEntity = null;
+ if (fInMarkup) {
+ fInMarkup = false;
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"MarkupEntityMismatch",
null,
@@ -568,7 +568,7 @@
// scan decl
super.scanXMLDeclOrTextDecl(scanningTextDecl, fPseudoAttributeValues);
- fMarkupEntity = null;
+ fInMarkup = false;
// pseudo-attribute values
String version = fPseudoAttributeValues[0];
@@ -608,7 +608,7 @@
throws IOException, SAXException {
super.scanPIData(target, data);
- fMarkupEntity = null;
+ fInMarkup = false;
// call handler
if (fDocumentHandler != null) {
@@ -629,7 +629,7 @@
protected void scanComment() throws IOException, SAXException {
scanComment(fStringBuffer);
- fMarkupEntity = null;
+ fInMarkup = false;
// call handler
if (fDocumentHandler != null) {
@@ -782,7 +782,7 @@
new Object[]{name},
XMLErrorReporter.SEVERITY_FATAL_ERROR);
}
- fMarkupEntity = null;
+ fInMarkup = false;
// call handler
if (fDocumentHandler != null) {
@@ -878,7 +878,7 @@
scanAttribute(fAttributes);
} while (true);
- fMarkupEntity = null;
+ fInMarkup = false;
// push element stack
fCurrentElement = fElementStack.pushElement(fElementQName);
@@ -1037,7 +1037,7 @@
System.out.println("*** scanning TextDecl");
}
if (fEntityScanner.skipString("<?xml")) {
- fMarkupEntity = fEntityManager.getCurrentEntity();
+ fInMarkup = true;
scanXMLDeclOrTextDecl(true);
}
}
@@ -1169,7 +1169,7 @@
}
}
}
- fMarkupEntity = null;
+ fInMarkup = false;
// call handler
if (fDocumentHandler != null) {
@@ -1214,7 +1214,7 @@
new Object[]{fElementQName.rawname},
XMLErrorReporter.SEVERITY_FATAL_ERROR);
}
- fMarkupEntity = null;
+ fInMarkup = false;
// handle end element
int depth = handleEndElement(fElementQName);
@@ -1267,7 +1267,7 @@
"SemicolonRequiredInReference",
null, XMLErrorReporter.SEVERITY_FATAL_ERROR);
}
- fMarkupEntity = null;
+ fInMarkup = false;
// handle built-in entities
if (name == fAmpSymbol) {
@@ -1670,7 +1670,7 @@
// scan XMLDecl
try {
if (fEntityScanner.skipString("<?xml")) {
- fMarkupEntity = fEntityManager.getCurrentEntity();
+ fInMarkup = true;
// NOTE: special case where document starts with a PI
// whose name starts with "xml" (e.g. "xmlfoo")
if (XMLChar.isName(fEntityScanner.peekChar())) {
@@ -1756,7 +1756,7 @@
break;
}
case SCANNER_STATE_START_OF_MARKUP: {
- fMarkupEntity = fEntityManager.getCurrentEntity();
+ fInMarkup = true;
if (fEntityScanner.skipChar('?')) {
setScannerState(SCANNER_STATE_PI);
again = true;
@@ -1898,13 +1898,13 @@
do {
int c = scanContent();
if (c == '<') {
- fMarkupEntity = fEntityManager.getCurrentEntity();
+ fInMarkup = true;
fEntityScanner.scanChar();
setScannerState(SCANNER_STATE_START_OF_MARKUP);
break;
}
else if (c == '&') {
- fMarkupEntity = fEntityManager.getCurrentEntity();
+ fInMarkup = true;
fEntityScanner.scanChar();
setScannerState(SCANNER_STATE_REFERENCE);
break;
@@ -1931,7 +1931,7 @@
break;
}
case SCANNER_STATE_START_OF_MARKUP: {
- fMarkupEntity = fEntityManager.getCurrentEntity();
+ fInMarkup = true;
if (fEntityScanner.skipChar('?')) {
setScannerState(SCANNER_STATE_PI);
again = true;
@@ -1993,7 +1993,7 @@
break;
}
case SCANNER_STATE_REFERENCE: {
- fMarkupEntity = fEntityManager.getCurrentEntity();
+ fInMarkup = true;
// NOTE: We need to set the state beforehand
// because the XMLEntityHandler#startEntity
// callback could set the state to
@@ -2011,7 +2011,7 @@
case SCANNER_STATE_TEXT_DECL: {
// scan text decl
if (fEntityScanner.skipString("<?xml")) {
- fMarkupEntity = fEntityManager.getCurrentEntity();
+ fInMarkup = true;
// NOTE: special case where entity starts with a PI
// whose name starts with "xml" (e.g. "xmlfoo")
if (XMLChar.isName(fEntityScanner.peekChar())) {
@@ -2111,7 +2111,7 @@
break;
}
case SCANNER_STATE_START_OF_MARKUP: {
- fMarkupEntity = fEntityManager.getCurrentEntity();
+ fInMarkup = true;
if (fEntityScanner.skipChar('?')) {
setScannerState(SCANNER_STATE_PI);
again = true;
@@ -2165,7 +2165,7 @@
// NOTE: This is the only place we're allowed to reach
// the real end of the document stream. Unless the
// end of file was reached prematurely.
- if (fMarkupEntity != null) {
+ if (fInMarkup) {
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"PrematureEOF",
null,