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/02/16 09:05:51 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/xni XMLDTDHandler.java XMLDocumentHandler.java
andyc 01/02/16 00:05:51
Modified: java/design/xml Tag: xerces_j_2 design-xni.ent
java/samples/xni Tag: xerces_j_2 DocumentTracer.java
java/src/org/apache/xerces/impl Tag: xerces_j_2
XMLDTDScanner.java XMLDocumentScanner.java
XMLEntityHandler.java XMLNamespaceBinder.java
XMLValidator.java
java/src/org/apache/xerces/impl/validation/grammars Tag:
xerces_j_2 DTDGrammar.java
java/src/org/apache/xerces/parsers Tag: xerces_j_2
AbstractDOMParser.java AbstractSAXParser.java
AbstractXMLDocumentParser.java DOMParser.java
Makefile SAXParser.java XMLDocumentParser.java
XMLParser.java
java/src/org/apache/xerces/xni Tag: xerces_j_2
XMLDTDHandler.java XMLDocumentHandler.java
Log:
Modified XMLDTDHandler interface:
1) Changed startEntity("[xml]",...) to pass systemId and
encoding to startDocument method.
2) Added characters method to report content of IGNORE
conditional section in DTD.
Thanks to Ryosuke Nanba <Ry...@justsystem.co.jp>
for API suggestions.
Revision Changes Path
No revision
No revision
1.1.2.2 +7 -1 xml-xerces/java/design/xml/Attic/design-xni.ent
Index: design-xni.ent
===================================================================
RCS file: /home/cvs/xml-xerces/java/design/xml/Attic/design-xni.ent,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- design-xni.ent 2001/01/16 09:11:15 1.1.2.1
+++ design-xni.ent 2001/02/16 08:05:43 1.1.2.2
@@ -1,5 +1,5 @@
<?xml encoding='US-ASCII'?>
-<!-- $Id: design-xni.ent,v 1.1.2.1 2001/01/16 09:11:15 andyc Exp $ -->
+<!-- $Id: design-xni.ent,v 1.1.2.2 2001/02/16 08:05:43 andyc Exp $ -->
<category name='Xerces Native Interface (XNI)' package='&package;.xni'>
<interface id='configurable' name='XMLComponent'>
@@ -92,6 +92,12 @@
<interface id='document-handler' name='XMLDocumentHandler'>
<method name='startDocument'>
+ <param name='systemId'>
+ <reference idref='java-string'/>
+ </param>
+ <param name='encoding'>
+ <reference idref='java-string'/>
+ </param>
<throws>
<reference idref='sax-exception'/>
</throws>
No revision
No revision
1.1.2.10 +112 -74 xml-xerces/java/samples/xni/Attic/DocumentTracer.java
Index: DocumentTracer.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/xni/Attic/DocumentTracer.java,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -r1.1.2.9 -r1.1.2.10
--- DocumentTracer.java 2000/12/28 08:23:55 1.1.2.9
+++ DocumentTracer.java 2001/02/16 08:05:44 1.1.2.10
@@ -83,7 +83,7 @@
* @author Andy Clark, IBM
* @author Arnaud Le Hors, IBM
*
- * @version $Id: DocumentTracer.java,v 1.1.2.9 2000/12/28 08:23:55 andyc Exp $
+ * @version $Id: DocumentTracer.java,v 1.1.2.10 2001/02/16 08:05:44 andyc Exp $
*/
public class DocumentTracer
extends XMLDocumentParser
@@ -167,12 +167,31 @@
// XMLDocumentHandler methods
//
- /** Start document. */
- public void startDocument() throws SAXException {
+ /**
+ * The start of the document.
+ *
+ * @param systemId The system identifier of the entity if the entity
+ * is external, null otherwise.
+ * @param encoding The auto-detected IANA encoding name of the entity
+ * stream. This value will be null in those situations
+ * where the entity encoding is not auto-detected (e.g.
+ * internal entities or a document entity that is
+ * parsed from a java.io.Reader).
+ *
+ * @throws SAXException Thrown by handler to signal an error.
+ */
+ public void startDocument(String systemId, String encoding)
+ throws SAXException {
fIndent = 0;
printIndent();
- fOut.println("startDocument()");
+ fOut.print("startDocument(");
+ fOut.print("systemId=");
+ printQuotedString(systemId);
+ fOut.print(',');
+ fOut.print("encoding=");
+ printQuotedString(encoding);
+ fOut.println(')');
fOut.flush();
fIndent++;
@@ -240,82 +259,25 @@
printIndent();
fOut.print("startElement(");
- fOut.print("element=");
- fOut.print('{');
- fOut.print("prefix=");
- printQuotedString(element.prefix);
- fOut.print(',');
- fOut.print("localpart=");
- printQuotedString(element.localpart);
- fOut.print(',');
- fOut.print("rawname=");
- printQuotedString(element.rawname);
- fOut.print(',');
- fOut.print("uri=");
- printQuotedString(element.uri);
- fOut.print('}');
- fOut.print(',');
- fOut.print("attributes=");
- if (attributes == null) {
- fOut.println("null");
- }
- else {
- fOut.print('{');
- int length = attributes.getLength();
- for (int i = 0; i < length; i++) {
- if (i > 0) {
- fOut.print(',');
- }
- attributes.getName(i, fQName);
- String attrType = attributes.getType(i);
- String attrValue = attributes.getValue(i);
- fOut.print("name=");
- fOut.print('{');
- fOut.print("prefix=");
- printQuotedString(fQName.prefix);
- fOut.print(',');
- fOut.print("localpart=");
- printQuotedString(fQName.localpart);
- fOut.print(',');
- fOut.print("rawname=");
- printQuotedString(fQName.rawname);
- fOut.print(',');
- fOut.print("uri=");
- printQuotedString(fQName.uri);
- fOut.print('}');
- fOut.print(',');
- fOut.print("type=");
- printQuotedString(attrType);
- fOut.print(',');
- fOut.print("value=");
- printQuotedString(attrValue);
- int entityCount = attributes.getEntityCount(i);
- for (int j = 0; j < entityCount; j++) {
- String entityName = attributes.getEntityName(i, j);
- int entityOffset = attributes.getEntityOffset(i, j);
- int entityLength = attributes.getEntityLength(i, j);
- fOut.print(',');
- fOut.print('[');
- fOut.print("name=");
- printQuotedString(entityName);
- fOut.print(',');
- fOut.print("offset=");
- fOut.print(entityOffset);
- fOut.print(',');
- fOut.print("length=");
- fOut.print(entityLength);
- fOut.print(']');
- }
- fOut.print('}');
- }
- fOut.print('}');
- }
+ printElement(element, attributes);
fOut.println(')');
fOut.flush();
fIndent++;
} // startElement(QName,XMLAttributes)
+ /** Empty element. */
+ public void emptyElement(QName element, XMLAttributes attributes)
+ throws SAXException {
+
+ printIndent();
+ fOut.print("emptyElement(");
+ printElement(element, attributes);
+ fOut.println(')');
+ fOut.flush();
+
+ } // emptyElement(QName,XMLAttributes)
+
/** Characters. */
public void characters(XMLString text) throws SAXException {
@@ -883,6 +845,82 @@
//
// Protected methods
//
+
+ /** Prints an element. */
+ protected void printElement(QName element, XMLAttributes attributes) {
+
+ fOut.print("element=");
+ fOut.print('{');
+ fOut.print("prefix=");
+ printQuotedString(element.prefix);
+ fOut.print(',');
+ fOut.print("localpart=");
+ printQuotedString(element.localpart);
+ fOut.print(',');
+ fOut.print("rawname=");
+ printQuotedString(element.rawname);
+ fOut.print(',');
+ fOut.print("uri=");
+ printQuotedString(element.uri);
+ fOut.print('}');
+ fOut.print(',');
+ fOut.print("attributes=");
+ if (attributes == null) {
+ fOut.println("null");
+ }
+ else {
+ fOut.print('{');
+ int length = attributes.getLength();
+ for (int i = 0; i < length; i++) {
+ if (i > 0) {
+ fOut.print(',');
+ }
+ attributes.getName(i, fQName);
+ String attrType = attributes.getType(i);
+ String attrValue = attributes.getValue(i);
+ fOut.print("name=");
+ fOut.print('{');
+ fOut.print("prefix=");
+ printQuotedString(fQName.prefix);
+ fOut.print(',');
+ fOut.print("localpart=");
+ printQuotedString(fQName.localpart);
+ fOut.print(',');
+ fOut.print("rawname=");
+ printQuotedString(fQName.rawname);
+ fOut.print(',');
+ fOut.print("uri=");
+ printQuotedString(fQName.uri);
+ fOut.print('}');
+ fOut.print(',');
+ fOut.print("type=");
+ printQuotedString(attrType);
+ fOut.print(',');
+ fOut.print("value=");
+ printQuotedString(attrValue);
+ int entityCount = attributes.getEntityCount(i);
+ for (int j = 0; j < entityCount; j++) {
+ String entityName = attributes.getEntityName(i, j);
+ int entityOffset = attributes.getEntityOffset(i, j);
+ int entityLength = attributes.getEntityLength(i, j);
+ fOut.print(',');
+ fOut.print('[');
+ fOut.print("name=");
+ printQuotedString(entityName);
+ fOut.print(',');
+ fOut.print("offset=");
+ fOut.print(entityOffset);
+ fOut.print(',');
+ fOut.print("length=");
+ fOut.print(entityLength);
+ fOut.print(']');
+ }
+ fOut.print('}');
+ }
+ fOut.print('}');
+ }
+
+ } // printElement(QName,XMLAttributes)
/** Print quoted string. */
protected void printQuotedString(String s) {
No revision
No revision
1.1.2.79 +29 -2 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.78
retrieving revision 1.1.2.79
diff -u -r1.1.2.78 -r1.1.2.79
--- XMLDTDScanner.java 2001/02/13 18:34:24 1.1.2.78
+++ XMLDTDScanner.java 2001/02/16 08:05:44 1.1.2.79
@@ -89,7 +89,7 @@
* @author Glenn Marcy, IBM
* @author Eric Ye, IBM
*
- * @version $Id: XMLDTDScanner.java,v 1.1.2.78 2001/02/13 18:34:24 lehors Exp $
+ * @version $Id: XMLDTDScanner.java,v 1.1.2.79 2001/02/16 08:05:44 andyc Exp $
*/
public class XMLDTDScanner
extends XMLScanner
@@ -173,6 +173,9 @@
private String[] fEnumeration = new String[5];
private int fEnumerationCount;
+ /** Ignore conditional section buffer. */
+ private XMLStringBuffer fIgnoreConditionalBuffer = new XMLStringBuffer(128);
+
//
// Constructors
//
@@ -1579,30 +1582,51 @@
reportFatalError("MSG_MARKUP_NOT_RECOGNIZED_IN_DTD", null);
}
int initialDepth = ++fIncludeSectDepth;
+ if (fDTDHandler != null) {
+ fIgnoreConditionalBuffer.clear();
+ }
while (true) {
if (fEntityScanner.skipChar('<')) {
+ if (fDTDHandler != null) {
+ fIgnoreConditionalBuffer.append('<');
+ }
//
// These tests are split so that we handle cases like
// '<<![' and '<!<![' which we might otherwise miss.
//
if (fEntityScanner.skipChar('!')
&& fEntityScanner.skipChar('[')) {
+ if (fDTDHandler != null) {
+ fIgnoreConditionalBuffer.append("![");
+ }
fIncludeSectDepth++;
}
}
else if (fEntityScanner.skipChar(']')) {
+ if (fDTDHandler != null) {
+ fIgnoreConditionalBuffer.append(']');
+ }
//
// The same thing goes for ']<![' and '<]]>', etc.
//
if (fEntityScanner.skipChar(']')) {
+ if (fDTDHandler != null) {
+ fIgnoreConditionalBuffer.append(']');
+ }
while (fEntityScanner.skipChar(']')) {
/* empty loop body */
+ if (fDTDHandler != null) {
+ fIgnoreConditionalBuffer.append(']');
+ }
}
if (fEntityScanner.skipChar('>')) {
if (fIncludeSectDepth-- == initialDepth) {
fMarkUpDepth--;
// call handler
if (fDTDHandler != null) {
+ fLiteral.setValues(fIgnoreConditionalBuffer.ch, 0,
+ fIgnoreConditionalBuffer.length - 2);
+ fDTDHandler.characters(fLiteral);
fDTDHandler.endConditional();
}
return;
@@ -1611,10 +1635,13 @@
}
}
else {
- fEntityScanner.scanChar();
+ int c = fEntityScanner.scanChar();
if (fScannerState == SCANNER_STATE_END_OF_INPUT) {
reportFatalError("IgnoreSectUnterminated", null);
return;
+ }
+ if (fDTDHandler != null) {
+ fIgnoreConditionalBuffer.append((char)c);
}
}
}
1.1.2.80 +22 -20 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.79
retrieving revision 1.1.2.80
diff -u -r1.1.2.79 -r1.1.2.80
--- XMLDocumentScanner.java 2001/02/13 18:36:11 1.1.2.79
+++ XMLDocumentScanner.java 2001/02/16 08:05:45 1.1.2.80
@@ -105,7 +105,7 @@
* @author Arnaud Le Hors, IBM
* @author Eric Ye, IBM
*
- * @version $Id: XMLDocumentScanner.java,v 1.1.2.79 2001/02/13 18:36:11 lehors Exp $
+ * @version $Id: XMLDocumentScanner.java,v 1.1.2.80 2001/02/16 08:05:45 andyc Exp $
*/
public class XMLDocumentScanner
extends XMLScanner
@@ -430,10 +430,9 @@
//
/**
- * This method notifies of the start of an entity. The document entity
- * has the pseudo-name of "[xml]"; the DTD has the pseudo-name of "[dtd];
- * parameter entity names start with '%'; and general entities are just
- * specified by their name.
+ * This method notifies of the start of an entity. The DTD has the
+ * pseudo-name of "[dtd]; parameter entity names start with '%'; and
+ * general entities are just specified by their name.
*
* @param name The name of the entity.
* @param publicId The public identifier of the entity if the entity
@@ -468,21 +467,20 @@
// call handler
if (fDocumentHandler != null) {
- if (!fScanningAttribute) {
- fDocumentHandler.startEntity(name, publicId, systemId, encoding);
- }
if (name.equals("[xml]")) {
- fDocumentHandler.startDocument();
+ fDocumentHandler.startDocument(systemId, encoding);
+ }
+ else if (!fScanningAttribute) {
+ fDocumentHandler.startEntity(name, publicId, systemId, encoding);
}
}
} // startEntity(String,String,String,String)
/**
- * This method notifies the end of an entity. The document entity has
- * the pseudo-name of "[xml]"; the DTD has the pseudo-name of "[dtd];
- * parameter entity names start with '%'; and general entities are just
- * specified by their name.
+ * This method notifies the end of an entity. The DTD has the pseudo-name
+ * of "[dtd]; parameter entity names start with '%'; and general entities
+ * are just specified by their name.
*
* @param name The name of the entity.
*
@@ -502,7 +500,7 @@
if (name.equals("[xml]")) {
fDocumentHandler.endDocument();
}
- if (!fScanningAttribute) {
+ else if (!fScanningAttribute) {
fDocumentHandler.endEntity(name);
}
}
@@ -758,10 +756,13 @@
// call handler
if (fDocumentHandler != null) {
- fDocumentHandler.startElement(fElementQName, fAttributes);
if (empty) {
- handleEndElement(fElementQName);
+ fDocumentHandler.emptyElement(fElementQName, fAttributes);
+ handleEndElement(fElementQName, true);
}
+ else {
+ fDocumentHandler.startElement(fElementQName, fAttributes);
+ }
}
if (DEBUG_CONTENT_SCANNING) System.out.println("<<< scanStartElement(): "+empty);
@@ -999,7 +1000,7 @@
fMarkupDepth--;
// handle end element
- int depth = handleEndElement(fElementQName);
+ int depth = handleEndElement(fElementQName, false);
if (DEBUG_CONTENT_SCANNING) System.out.println("<<< scanEndElement(): "+depth);
return depth;
@@ -1116,7 +1117,8 @@
* upon notification.
*
*/
- protected int handleEndElement(QName element) throws SAXException {
+ protected int handleEndElement(QName element, boolean isEmpty)
+ throws SAXException {
fMarkupDepth--;
// check that this element was opened in the same entity
@@ -1138,13 +1140,13 @@
}
// call handler
- if (fDocumentHandler != null) {
+ if (fDocumentHandler != null && !isEmpty) {
fDocumentHandler.endElement(element);
}
return fMarkupDepth;
- } // callEndElement(QName):int
+ } // callEndElement(QName,boolean):int
// helper methods
1.1.2.2 +7 -9 xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLEntityHandler.java
Index: XMLEntityHandler.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLEntityHandler.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- XMLEntityHandler.java 2000/10/12 17:16:20 1.1.2.1
+++ XMLEntityHandler.java 2001/02/16 08:05:45 1.1.2.2
@@ -68,7 +68,7 @@
* @author Stubs generated by DesignDoc on Mon Sep 18 18:23:16 PDT 2000
* @author Andy Clark, IBM
*
- * @version $Id: XMLEntityHandler.java,v 1.1.2.1 2000/10/12 17:16:20 andyc Exp $
+ * @version $Id: XMLEntityHandler.java,v 1.1.2.2 2001/02/16 08:05:45 andyc Exp $
*/
public interface XMLEntityHandler {
@@ -77,10 +77,9 @@
//
/**
- * This method notifies of the start of an entity. The document entity
- * has the pseudo-name of "[xml]"; the DTD has the pseudo-name of "[dtd];
- * parameter entity names start with '%'; and general entities are just
- * specified by their name.
+ * This method notifies of the start of an entity. The DTD has the
+ * pseudo-name of "[dtd]; parameter entity names start with '%'; and
+ * general entities are just specified by their name.
*
* @param name The name of the entity.
* @param publicId The public identifier of the entity if the entity
@@ -99,10 +98,9 @@
String encoding) throws SAXException;
/**
- * This method notifies the end of an entity. The document entity has
- * the pseudo-name of "[xml]"; the DTD has the pseudo-name of "[dtd];
- * parameter entity names start with '%'; and general entities are just
- * specified by their name.
+ * This method notifies the end of an entity. The DTD has the pseudo-name
+ * of "[dtd]; parameter entity names start with '%'; and general entities
+ * are just specified by their name.
*
* @param name The name of the entity.
*
1.1.2.4 +25 -22 xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLNamespaceBinder.java
Index: XMLNamespaceBinder.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLNamespaceBinder.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- XMLNamespaceBinder.java 2001/01/05 06:30:21 1.1.2.3
+++ XMLNamespaceBinder.java 2001/02/16 08:05:45 1.1.2.4
@@ -93,7 +93,7 @@
*
* @author Andy Clark, IBM
*
- * @version $Id: XMLNamespaceBinder.java,v 1.1.2.3 2001/01/05 06:30:21 andyc Exp $
+ * @version $Id: XMLNamespaceBinder.java,v 1.1.2.4 2001/02/16 08:05:45 andyc Exp $
*/
public class XMLNamespaceBinder
implements XMLComponent, XMLDocumentFilter {
@@ -267,16 +267,9 @@
//
/**
- * This method notifies the start of an entity. The document entity has
- * the pseudo-name of "[xml]"; and general entities are just specified
- * by their name.
+ * This method notifies the start of an entity. General entities are just
+ * specified by their name.
* <p>
- * <strong>Note:</strong> Since the document is an entity, the handler
- * will be notified of the start of the document entity by calling the
- * startEntity method with the entity name "[xml]" <em>before</em> calling
- * the startDocument method. When exposing entity boundaries through the
- * SAX API, the document entity is never reported, however.
- * <p>
* <strong>Note:</strong> This method is not called for entity references
* appearing as part of attribute values.
*
@@ -328,11 +321,12 @@
*
* @throws SAXException Thrown by handler to signal an error.
*/
- public void startDocument() throws SAXException {
+ public void startDocument(String systemId, String encoding)
+ throws SAXException {
if (fDocumentHandler != null && !fOnlyPassPrefixMappingEvents) {
- fDocumentHandler.startDocument();
+ fDocumentHandler.startDocument(systemId, encoding);
}
- } // startDocument()
+ } // startDocument(String,String)
/**
* Notifies of the presence of an XMLDecl line in the document. If
@@ -519,6 +513,22 @@
} // startElement(QName,XMLAttributes)
/**
+ * An empty element.
+ *
+ * @param element The name of the element.
+ * @param attributes The element attributes.
+ *
+ * @throws SAXException Thrown by handler to signal an error.
+ */
+ public void emptyElement(QName element, XMLAttributes attributes)
+ throws SAXException {
+
+ startElement(element, attributes);
+ endElement(element);
+
+ } // emptyElement(QName,XMLAttributes)
+
+ /**
* Character content.
*
* @param text The content.
@@ -634,15 +644,8 @@
} // endDocument()
/**
- * This method notifies the end of an entity. The document entity has
- * the pseudo-name of "[xml]"; and general entities are just specified
- * by their name.
- * <p>
- * <strong>Note:</strong> Since the document is an entity, the handler
- * will be notified of the end of the document entity by calling the
- * endEntity method with the entity name "[xml]" <em>after</em> calling
- * the endDocument method. When exposing entity boundaries through the
- * SAX API, the document entity is never reported, however.
+ * This method notifies the end of an entity. General entities are just
+ * specified by their name.
* <p>
* <strong>Note:</strong> This method is not called for entity references
* appearing as part of attribute values.
1.1.2.64 +302 -261 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.63
retrieving revision 1.1.2.64
diff -u -r1.1.2.63 -r1.1.2.64
--- XMLValidator.java 2001/01/30 04:17:01 1.1.2.63
+++ XMLValidator.java 2001/02/16 08:05:45 1.1.2.64
@@ -126,7 +126,7 @@
* @author Andy Clark, IBM
* @author Jeffrey Rodriguez IBM
*
- * @version $Id: XMLValidator.java,v 1.1.2.63 2001/01/30 04:17:01 andyc Exp $
+ * @version $Id: XMLValidator.java,v 1.1.2.64 2001/02/16 08:05:45 andyc Exp $
*/
public class XMLValidator
implements XMLComponent,
@@ -598,16 +598,25 @@
/**
* The start of the document.
*
+ * @param systemId The system identifier of the entity if the entity
+ * is external, null otherwise.
+ * @param encoding The auto-detected IANA encoding name of the entity
+ * stream. This value will be null in those situations
+ * where the entity encoding is not auto-detected (e.g.
+ * internal entities or a document entity that is
+ * parsed from a java.io.Reader).
+ *
* @throws SAXException Thrown by handler to signal an error.
*/
- public void startDocument() throws SAXException {
+ public void startDocument(String systemId, String encoding)
+ throws SAXException {
// call handlers
if (fDocumentHandler != null) {
- fDocumentHandler.startDocument();
+ fDocumentHandler.startDocument(systemId, encoding);
}
- } // startDocument()
+ } // startDocument(String,String)
/**
* Notifies of the presence of an XMLDecl line in the document. If
@@ -678,9 +687,7 @@
} // startPrefixMapping(String,String)
/**
- * The start of an element. If the document specifies the start element
- * by using an empty tag, then the startElement method will immediately
- * be followed by the endElement method, with no intervening methods.
+ * The start of an element.
*
* @param element The name of the element.
* @param attributes The element attributes.
@@ -689,103 +696,25 @@
*/
public void startElement(QName element, XMLAttributes attributes)
throws SAXException {
-
- // VC: Root Element Type
- // see if the root element's name matches the one in DoctypeDecl
- if (!fSeenRootElement) {
- fSeenRootElement = true;
- if (fCurrentGrammarIsDTD) {
- rootElementSpecified(element);
- }
- }
-
- // bind namespaces, if current grammar is Schema
- if (fNamespaces && fCurrentGrammarIsSchema) {
- fNamespaceBinder.startElement(element, attributes);
- }
-
- if (fCurrentGrammar == null && !fValidation) {
- fCurrentElementIndex = -1;
- fCurrentContentSpecType = -1;
- fInElementContent = false;
- }
- else if (fCurrentGrammarIsDTD) {
- // resolve the element
- fCurrentElementIndex = fCurrentGrammar.getElementDeclIndex(element, -1);
-
- fCurrentContentSpecType = getContentSpecType(fCurrentElementIndex);
- if (fCurrentElementIndex == -1 && fValidation) {
- fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
- "MSG_ELEMENT_NOT_DECLARED",
- new Object[]{ element.rawname},
- XMLErrorReporter.SEVERITY_ERROR);
- }
- else {
- // 0. insert default attributes
- // 1. normalize the attributes
- // 2. validate the attrivute list.
- // TO DO:
- //
- addDTDDefaultAttrsAndValidate(fCurrentElementIndex, attributes);
- }
- }
-
- // buffer datatype value for Schema datatype validation
- if (fValidation && fCurrentContentSpecType == XMLElementDecl.TYPE_SIMPLE) {
- fBufferDatatype = true;
- fDatatypeBuffer.setLength(0);
- }
- // set element content state
- fInElementContent = fCurrentContentSpecType == XMLElementDecl.TYPE_CHILDREN;
+ handleStartElement(element, attributes, false);
- // increment the element depth, add this element's
- // QName to its enclosing element 's children list
- fElementDepth++;
- if (fValidation) {
- // push current length onto stack
- if (fElementChildrenOffsetStack.length < fElementDepth) {
- int newarray[] = new int[fElementChildrenOffsetStack.length * 2];
- System.arraycopy(fElementChildrenOffsetStack, 0, newarray, 0, fElementChildrenOffsetStack.length);
- fElementChildrenOffsetStack = newarray;
- }
- fElementChildrenOffsetStack[fElementDepth] = fElementChildrenLength;
-
- // add this element to children
- if (fElementChildren.length <= fElementChildrenLength) {
- QName[] newarray = new QName[fElementChildrenLength * 2];
- System.arraycopy(fElementChildren, 0, newarray, 0, fElementChildren.length);
- fElementChildren = newarray;
- }
- QName qname = fElementChildren[fElementChildrenLength];
- if (qname == null) {
- for (int i = fElementChildrenLength; i < fElementChildren.length; i++) {
- fElementChildren[i] = new QName();
- }
- qname = fElementChildren[fElementChildrenLength];
- }
- qname.setValues(element);
- fElementChildrenLength++;
- }
-
- // bind namespaces, if current grammar is DTD
- if (fNamespaces && fCurrentGrammarIsDTD) {
- fNamespaceBinder.startElement(element, attributes);
- }
+ } // startElement(QName,XMLAttributes)
- // save current element information
- fCurrentElement.setValues(element);
- ensureStackCapacity(fElementDepth);
- fElementQNamePartsStack[fElementDepth].setValues(fCurrentElement);
- fElementIndexStack[fElementDepth] = fCurrentElementIndex;
- fContentSpecTypeStack[fElementDepth] = fCurrentContentSpecType;
+ /**
+ * An empty element.
+ *
+ * @param element The name of the element.
+ * @param attributes The element attributes.
+ *
+ * @throws SAXException Thrown by handler to signal an error.
+ */
+ public void emptyElement(QName element, XMLAttributes attributes)
+ throws SAXException {
- // call handlers
- if (fDocumentHandler != null) {
- fDocumentHandler.startElement(element, attributes);
- }
+ handleStartElement(element, attributes, true);
- } // startElement(QName,XMLAttributes)
+ } // emptyElement(QName,XMLAttributes)
/**
* Character content.
@@ -795,57 +724,68 @@
* @throws SAXException Thrown by handler to signal an error.
*/
public void characters(XMLString text) throws SAXException {
- boolean callNextCharacters = true;
- // REVISIT: [Q] Is there a more efficient way of doing this?
- // Perhaps if the scanner told us so we don't have to
- // look at the characters again. -Ac
- boolean allWhiteSpace = true;
- for (int i=text.offset; i< text.offset+text.length; i++) {
- if (!XMLChar.isSpace(text.ch[i])) {
- allWhiteSpace = false;
- break;
+ // ignored characters in DTD
+ if (fInDTD) {
+ if (fDTDHandler != null) {
+ fDTDHandler.characters(text);
}
}
- // call the ignoreableWhiteSpace callback
- if (fInElementContent && allWhiteSpace) {
- if (fDocumentHandler != null) {
- fDocumentHandler.ignorableWhitespace(text);
- callNextCharacters = false;
+ // characters in content
+ else {
+ boolean callNextCharacters = true;
+
+ // REVISIT: [Q] Is there a more efficient way of doing this?
+ // Perhaps if the scanner told us so we don't have to
+ // look at the characters again. -Ac
+ boolean allWhiteSpace = true;
+ for (int i=text.offset; i< text.offset+text.length; i++) {
+ if (!XMLChar.isSpace(text.ch[i])) {
+ allWhiteSpace = false;
+ break;
+ }
}
- }
-
- // validate
- if (fValidation) {
- if (fInElementContent) {
- if (fCurrentGrammarIsDTD &&
- fStandaloneIsYes &&
- ((DTDGrammar)fCurrentGrammar).getElementDeclIsExternal(fCurrentElementIndex)) {
- if (allWhiteSpace) {
- fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,
- "MSG_WHITE_SPACE_IN_ELEMENT_CONTENT_WHEN_STANDALONE",
- null, XMLErrorReporter.SEVERITY_ERROR);
+
+ // call the ignoreableWhiteSpace callback
+ if (fInElementContent && allWhiteSpace) {
+ if (fDocumentHandler != null) {
+ fDocumentHandler.ignorableWhitespace(text);
+ callNextCharacters = false;
+ }
+ }
+
+ // validate
+ if (fValidation) {
+ if (fInElementContent) {
+ if (fCurrentGrammarIsDTD &&
+ fStandaloneIsYes &&
+ ((DTDGrammar)fCurrentGrammar).getElementDeclIsExternal(fCurrentElementIndex)) {
+ if (allWhiteSpace) {
+ fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,
+ "MSG_WHITE_SPACE_IN_ELEMENT_CONTENT_WHEN_STANDALONE",
+ null, XMLErrorReporter.SEVERITY_ERROR);
+ }
+ }
+ if (!allWhiteSpace) {
+ charDataInContent();
}
}
- if (!allWhiteSpace) {
+
+ if (fCurrentContentSpecType == XMLElementDecl.TYPE_EMPTY) {
charDataInContent();
}
- }
-
- if (fCurrentContentSpecType == XMLElementDecl.TYPE_EMPTY) {
- charDataInContent();
+ if (fBufferDatatype) {
+ fDatatypeBuffer.append(text.ch, text.offset, text.length);
+ }
}
- if (fBufferDatatype) {
- fDatatypeBuffer.append(text.ch, text.offset, text.length);
+
+ // call handlers
+ if (callNextCharacters && fDocumentHandler != null) {
+ fDocumentHandler.characters(text);
}
}
- // call handlers
- if (callNextCharacters && fDocumentHandler != null) {
- fDocumentHandler.characters(text);
- }
-
} // characters(XMLString)
/**
@@ -877,111 +817,9 @@
* @throws SAXException Thrown by handler to signal an error.
*/
public void endElement(QName element) throws SAXException {
-
- // decrease element depth
- fElementDepth--;
-
- // validate
- if (fValidation) {
- int elementIndex = fCurrentElementIndex;
- if (elementIndex != -1 && fCurrentContentSpecType != -1) {
- QName children[] = fElementChildren;
- int childrenOffset = fElementChildrenOffsetStack[fElementDepth + 1] + 1;
- int childrenLength = fElementChildrenLength - childrenOffset;
- int result = checkContent(elementIndex,
- children, childrenOffset, childrenLength);
- if (result != -1) {
- fCurrentGrammar.getElementDecl(elementIndex, fTempElementDecl);
- if (fTempElementDecl.type == XMLElementDecl.TYPE_EMPTY) {
- fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
- "MSG_CONTENT_INVALID",
- new Object[]{ element.rawname, "EMPTY"},
- XMLErrorReporter.SEVERITY_ERROR);
- }
- else {
- String messageKey = result != childrenLength ?
- "MSG_CONTENT_INVALID" : "MSG_CONTENT_INCOMPLETE";
- fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
- messageKey,
- new Object[]{ element.rawname,
- fCurrentGrammar.getContentSpecAsString(elementIndex)},
- XMLErrorReporter.SEVERITY_ERROR);
- }
- }
- }
- fElementChildrenLength = fElementChildrenOffsetStack[fElementDepth + 1] + 1;
- }
-
- // call handlers
- if (fDocumentHandler != null) {
- // NOTE: The binding of the element doesn't actually happen
- // yet because the namespace binder does that. However,
- // if it does it before this point, then the endPrefix-
- // Mapping calls get made too soon! As long as the
- // rawnames match, we know it'll have a good binding,
- // so we can just use the current element. -Ac
- fDocumentHandler.endElement(fCurrentElement);
- }
-
- // unbind prefixes
- if (fNamespaces) {
- fNamespaceBinder.endElement(element);
- }
-
- // now pop this element off the top of the element stack
- if (fElementDepth < -1) {
- throw new RuntimeException("FWK008 Element stack underflow");
- }
- if (fElementDepth < 0) {
- fCurrentElement.clear();
- fCurrentElementIndex = -1;
- fCurrentContentSpecType = -1;
- fInElementContent = false;
-
- // TO DO : fix this
- //
- // Check after document is fully parsed
- // (1) check that there was an element with a matching id for every
- // IDREF and IDREFS attr (V_IDREF0)
- //
- if (fValidation) {
- try {
- fValIDRef.validate();//Do final validation of IDREFS against IDs
- fValIDRefs.validate();
- }
- catch (InvalidDatatypeValueException ex) {
- String key = ex.getKeyIntoReporter();
-
- fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,
- key,
- new Object[]{ ex.getMessage()},
- XMLErrorReporter.SEVERITY_ERROR );
- }
- fTableOfIDs.clear();//Clear table of IDs
- }
- return;
- }
-
- // If Namespace enable then localName != rawName
- fCurrentElement.setValues(fElementQNamePartsStack[fElementDepth]);
- if (fNamespaces) {
- fCurrentElement.localpart = fElementQNamePartsStack[fElementDepth].localpart;
- }
- // REVISIT: jeffreyr - This is so we still do old behavior when
- // namespace is off
- else {
- fCurrentElement.localpart = fElementQNamePartsStack[fElementDepth].rawname;
- }
-
- fCurrentElementIndex = fElementIndexStack[fElementDepth];
- fCurrentContentSpecType = fContentSpecTypeStack[fElementDepth];
- fInElementContent = (fCurrentContentSpecType == XMLElementDecl.TYPE_CHILDREN);
-
- if (fValidation) {
- fBufferDatatype = false;
- }
-
+ handleEndElement(element, false);
+
} // endElement(QName)
/**
@@ -1052,16 +890,9 @@
//
/**
- * This method notifies of the start of an entity. The document entity
- * has the pseudo-name of "[xml]"; The DTD has the pseudo-name of "[dtd];
- * parameter entity names start with '%'; and general entity names are
- * just the entity name.
- * <p>
- * <strong>Note:</strong> Since the document is an entity, the handler
- * will be notified of the start of the document entity by calling the
- * startEntity method with the entity name "[xml]" <em>before</em> calling
- * the startDocument method. When exposing entity boundaries through the
- * SAX API, the document entity is never reported, however.
+ * This method notifies of the start of an entity. The DTD has the
+ * pseudo-name of "[dtd]; parameter entity names start with '%'; and
+ * general entity names are just the entity name.
* <p>
* <strong>Note:</strong> Since the DTD is an entity, the handler
* will be notified of the start of the DTD entity by calling the
@@ -1208,16 +1039,9 @@
} // processingInstruction(String,XMLString)
/**
- * This method notifies the end of an entity. The document entity has
- * the pseudo-name of "[xml]"; the DTD has the pseudo-name of "[dtd];
- * parameter entity names start with '%'; and general entity names are
- * just the entity name.
- * <p>
- * <strong>Note:</strong> Since the document is an entity, the handler
- * will be notified of the end of the document entity by calling the
- * endEntity method with the entity name "[xml]" <em>after</em> calling
- * the endDocument method. When exposing entity boundaries through the
- * SAX API, the document entity is never reported, however.
+ * This method notifies the end of an entity. The DTD has the pseudo-name
+ * of "[dtd]; parameter entity names start with '%'; and general entity
+ * names are just the entity name.
* <p>
* <strong>Note:</strong> Since the DTD is an entity, the handler
* will be notified of the end of the DTD entity by calling the
@@ -2733,6 +2557,223 @@
//
// Protected methods
//
+
+ /** Handle element. */
+ protected void handleStartElement(QName element, XMLAttributes attributes,
+ boolean isEmpty) throws SAXException {
+
+ // VC: Root Element Type
+ // see if the root element's name matches the one in DoctypeDecl
+ if (!fSeenRootElement) {
+ fSeenRootElement = true;
+ if (fCurrentGrammarIsDTD) {
+ rootElementSpecified(element);
+ }
+ }
+
+ // bind namespaces, if current grammar is Schema
+ if (fNamespaces && fCurrentGrammarIsSchema) {
+ fNamespaceBinder.startElement(element, attributes);
+ }
+
+ if (fCurrentGrammar == null && !fValidation) {
+ fCurrentElementIndex = -1;
+ fCurrentContentSpecType = -1;
+ fInElementContent = false;
+ }
+ else if (fCurrentGrammarIsDTD) {
+ // resolve the element
+ fCurrentElementIndex = fCurrentGrammar.getElementDeclIndex(element, -1);
+
+ fCurrentContentSpecType = getContentSpecType(fCurrentElementIndex);
+ if (fCurrentElementIndex == -1 && fValidation) {
+ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
+ "MSG_ELEMENT_NOT_DECLARED",
+ new Object[]{ element.rawname},
+ XMLErrorReporter.SEVERITY_ERROR);
+ }
+ else {
+ // 0. insert default attributes
+ // 1. normalize the attributes
+ // 2. validate the attrivute list.
+ // TO DO:
+ //
+ addDTDDefaultAttrsAndValidate(fCurrentElementIndex, attributes);
+ }
+ }
+
+ // buffer datatype value for Schema datatype validation
+ if (fValidation && fCurrentContentSpecType == XMLElementDecl.TYPE_SIMPLE) {
+ fBufferDatatype = true;
+ fDatatypeBuffer.setLength(0);
+ }
+
+ // set element content state
+ fInElementContent = fCurrentContentSpecType == XMLElementDecl.TYPE_CHILDREN;
+
+ // increment the element depth, add this element's
+ // QName to its enclosing element 's children list
+ fElementDepth++;
+ if (fValidation) {
+ // push current length onto stack
+ if (fElementChildrenOffsetStack.length < fElementDepth) {
+ int newarray[] = new int[fElementChildrenOffsetStack.length * 2];
+ System.arraycopy(fElementChildrenOffsetStack, 0, newarray, 0, fElementChildrenOffsetStack.length);
+ fElementChildrenOffsetStack = newarray;
+ }
+ fElementChildrenOffsetStack[fElementDepth] = fElementChildrenLength;
+
+ // add this element to children
+ if (fElementChildren.length <= fElementChildrenLength) {
+ QName[] newarray = new QName[fElementChildrenLength * 2];
+ System.arraycopy(fElementChildren, 0, newarray, 0, fElementChildren.length);
+ fElementChildren = newarray;
+ }
+ QName qname = fElementChildren[fElementChildrenLength];
+ if (qname == null) {
+ for (int i = fElementChildrenLength; i < fElementChildren.length; i++) {
+ fElementChildren[i] = new QName();
+ }
+ qname = fElementChildren[fElementChildrenLength];
+ }
+ qname.setValues(element);
+ fElementChildrenLength++;
+ }
+
+ // bind namespaces, if current grammar is DTD
+ if (fNamespaces && fCurrentGrammarIsDTD) {
+ fNamespaceBinder.startElement(element, attributes);
+ }
+
+ // save current element information
+ fCurrentElement.setValues(element);
+ ensureStackCapacity(fElementDepth);
+ fElementQNamePartsStack[fElementDepth].setValues(fCurrentElement);
+ fElementIndexStack[fElementDepth] = fCurrentElementIndex;
+ fContentSpecTypeStack[fElementDepth] = fCurrentContentSpecType;
+
+ // call handlers
+ if (fDocumentHandler != null) {
+ if (isEmpty) {
+ fDocumentHandler.emptyElement(element, attributes);
+ handleEndElement(element, isEmpty);
+ }
+ else {
+ fDocumentHandler.startElement(element, attributes);
+ }
+ }
+
+ } // handleStartElement(QName,XMLAttributes,boolean)
+
+ /** Handle end element. */
+ protected void handleEndElement(QName element, boolean isEmpty)
+ throws SAXException {
+
+ // decrease element depth
+ fElementDepth--;
+
+ // validate
+ if (fValidation) {
+ int elementIndex = fCurrentElementIndex;
+ if (elementIndex != -1 && fCurrentContentSpecType != -1) {
+ QName children[] = fElementChildren;
+ int childrenOffset = fElementChildrenOffsetStack[fElementDepth + 1] + 1;
+ int childrenLength = fElementChildrenLength - childrenOffset;
+ int result = checkContent(elementIndex,
+ children, childrenOffset, childrenLength);
+
+ if (result != -1) {
+ fCurrentGrammar.getElementDecl(elementIndex, fTempElementDecl);
+ if (fTempElementDecl.type == XMLElementDecl.TYPE_EMPTY) {
+ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
+ "MSG_CONTENT_INVALID",
+ new Object[]{ element.rawname, "EMPTY"},
+ XMLErrorReporter.SEVERITY_ERROR);
+ }
+ else {
+ String messageKey = result != childrenLength ?
+ "MSG_CONTENT_INVALID" : "MSG_CONTENT_INCOMPLETE";
+ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
+ messageKey,
+ new Object[]{ element.rawname,
+ fCurrentGrammar.getContentSpecAsString(elementIndex)},
+ XMLErrorReporter.SEVERITY_ERROR);
+ }
+ }
+ }
+ fElementChildrenLength = fElementChildrenOffsetStack[fElementDepth + 1] + 1;
+ }
+
+ // call handlers
+ if (fDocumentHandler != null && !isEmpty) {
+ // NOTE: The binding of the element doesn't actually happen
+ // yet because the namespace binder does that. However,
+ // if it does it before this point, then the endPrefix-
+ // Mapping calls get made too soon! As long as the
+ // rawnames match, we know it'll have a good binding,
+ // so we can just use the current element. -Ac
+ fDocumentHandler.endElement(fCurrentElement);
+ }
+
+ // unbind prefixes
+ if (fNamespaces) {
+ fNamespaceBinder.endElement(element);
+ }
+
+ // now pop this element off the top of the element stack
+ if (fElementDepth < -1) {
+ throw new RuntimeException("FWK008 Element stack underflow");
+ }
+ if (fElementDepth < 0) {
+ fCurrentElement.clear();
+ fCurrentElementIndex = -1;
+ fCurrentContentSpecType = -1;
+ fInElementContent = false;
+
+ // TO DO : fix this
+ //
+ // Check after document is fully parsed
+ // (1) check that there was an element with a matching id for every
+ // IDREF and IDREFS attr (V_IDREF0)
+ //
+ if (fValidation) {
+ try {
+ fValIDRef.validate();//Do final validation of IDREFS against IDs
+ fValIDRefs.validate();
+ }
+ catch (InvalidDatatypeValueException ex) {
+ String key = ex.getKeyIntoReporter();
+
+ fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,
+ key,
+ new Object[]{ ex.getMessage()},
+ XMLErrorReporter.SEVERITY_ERROR );
+ }
+ fTableOfIDs.clear();//Clear table of IDs
+ }
+ return;
+ }
+
+ // If Namespace enable then localName != rawName
+ fCurrentElement.setValues(fElementQNamePartsStack[fElementDepth]);
+ if (fNamespaces) {
+ fCurrentElement.localpart = fElementQNamePartsStack[fElementDepth].localpart;
+ }
+ // REVISIT: jeffreyr - This is so we still do old behavior when
+ // namespace is off
+ else {
+ fCurrentElement.localpart = fElementQNamePartsStack[fElementDepth].rawname;
+ }
+
+ fCurrentElementIndex = fElementIndexStack[fElementDepth];
+ fCurrentContentSpecType = fContentSpecTypeStack[fElementDepth];
+ fInElementContent = (fCurrentContentSpecType == XMLElementDecl.TYPE_CHILDREN);
+
+ if (fValidation) {
+ fBufferDatatype = false;
+ }
+
+ } // handleEndElement(QName,boolean)
/** Factory method for creating a DTD grammar. */
protected DTDGrammar createDTDGrammar() {
No revision
No revision
1.1.2.38 +10 -1 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.37
retrieving revision 1.1.2.38
diff -u -r1.1.2.37 -r1.1.2.38
--- DTDGrammar.java 2001/01/30 04:17:02 1.1.2.37
+++ DTDGrammar.java 2001/02/16 08:05:47 1.1.2.38
@@ -92,7 +92,7 @@
* @author Jeffrey Rodriguez, IBM
* @author Andy Clark, IBM
*
- * @version $Id: DTDGrammar.java,v 1.1.2.37 2001/01/30 04:17:02 andyc Exp $
+ * @version $Id: DTDGrammar.java,v 1.1.2.38 2001/02/16 08:05:47 andyc Exp $
*/
public class DTDGrammar
extends Grammar
@@ -683,6 +683,15 @@
public void startConditional(short type) throws SAXException {
// no-op
} // startConditional(short)
+
+ /**
+ * Characters within an IGNORE conditional section.
+ *
+ * @param text The ignored text.
+ */
+ public void characters(XMLString text) throws SAXException {
+ // no-op
+ } // characters(XMLString)
/**
* The end of a conditional section.
No revision
No revision
1.1.2.4 +19 -49 xml-xerces/java/src/org/apache/xerces/parsers/Attic/AbstractDOMParser.java
Index: AbstractDOMParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Attic/AbstractDOMParser.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- AbstractDOMParser.java 2001/02/14 02:10:30 1.1.2.3
+++ AbstractDOMParser.java 2001/02/16 08:05:48 1.1.2.4
@@ -91,7 +91,7 @@
* @author Andy Clark, IBM
*
*
- * @version $Id: AbstractDOMParser.java,v 1.1.2.3 2001/02/14 02:10:30 lehors Exp $ */
+ * @version $Id: AbstractDOMParser.java,v 1.1.2.4 2001/02/16 08:05:48 andyc Exp $ */
public abstract class AbstractDOMParser
extends AbstractXMLDocumentParser {
@@ -115,9 +115,6 @@
/** True if inside document. */
protected boolean fInDocument;
- /** True if inside DTD. */
- protected boolean fInDTD;
-
/** True if inside CDATA section. */
protected boolean fInCDATASection;
@@ -178,16 +175,9 @@
//
/**
- * This method notifies of the start of an entity. The document entity
- * has the pseudo-name of "[xml]"; The DTD has the pseudo-name of "[dtd];
- * parameter entity names start with '%'; and general entity names are
- * just the entity name.
- * <p>
- * <strong>Note:</strong> Since the document is an entity, the handler
- * will be notified of the start of the document entity by calling the
- * startEntity method with the entity name "[xml]" <em>before</em> calling
- * the startDocument method. When exposing entity boundaries through the
- * SAX API, the document entity is never reported, however.
+ * This method notifies of the start of an entity. The DTD has the
+ * pseudo-name of "[dtd]; parameter entity names start with '%'; and
+ * general entity names are just the entity name.
* <p>
* <strong>Note:</strong> Since the DTD is an entity, the handler
* will be notified of the start of the DTD entity by calling the
@@ -261,9 +251,18 @@
/**
* The start of the document.
*
+ * @param systemId The system identifier of the entity if the entity
+ * is external, null otherwise.
+ * @param encoding The auto-detected IANA encoding name of the entity
+ * stream. This value will be null in those situations
+ * where the entity encoding is not auto-detected (e.g.
+ * internal entities or a document entity that is
+ * parsed from a java.io.Reader).
+ *
* @throws SAXException Thrown by handler to signal an error.
*/
- public void startDocument() throws SAXException {
+ public void startDocument(String systemId, String encoding)
+ throws SAXException {
fInDocument = true;
fDocument = new DocumentImpl();
@@ -272,7 +271,7 @@
// set DOM error checking off
fDocumentImpl.setErrorChecking(false);
- } // startDocument()
+ } // startDocument(String,String)
/**
* Notifies of the presence of the DOCTYPE line in the document.
@@ -345,7 +344,7 @@
CDATASection cdataSection = (CDATASection)fCurrentNode;
cdataSection.appendData(text.toString());
}
- else {
+ else if (!fInDTD) {
Node child = fCurrentNode.getLastChild();
if (child != null && child.getNodeType() == Node.TEXT_NODE) {
Text textNode = (Text)child;
@@ -456,17 +455,10 @@
} // endDocument()
/**
- * This method notifies the end of an entity. The document entity has
- * the pseudo-name of "[xml]"; the DTD has the pseudo-name of "[dtd];
- * parameter entity names start with '%'; and general entity names are
- * just the entity name.
+ * This method notifies the end of an entity. The DTD has the pseudo-name
+ * of "[dtd]; parameter entity names start with '%'; and general entity
+ * names are just the entity name.
* <p>
- * <strong>Note:</strong> Since the document is an entity, the handler
- * will be notified of the end of the document entity by calling the
- * endEntity method with the entity name "[xml]" <em>after</em> calling
- * the endDocument method. When exposing entity boundaries through the
- * SAX API, the document entity is never reported, however.
- * <p>
* <strong>Note:</strong> Since the DTD is an entity, the handler
* will be notified of the end of the DTD entity by calling the
* endEntity method with the entity name "[dtd]" <em>after</em> calling
@@ -486,28 +478,6 @@
}
} // endEntity(String)
-
- //
- // XMLDTDHandler methods
- //
-
- /**
- * The start of the DTD.
- *
- * @throws SAXException Thrown by handler to signal an error.
- */
- public void startDTD() throws SAXException {
- fInDTD = true;
- } // startDTD()
-
- /**
- * The end of the DTD.
- *
- * @throws SAXException Thrown by handler to signal an error.
- */
- public void endDTD() throws SAXException {
- fInDTD = false;
- } // endDTD()
//
// Protected methods
1.1.2.4 +24 -25 xml-xerces/java/src/org/apache/xerces/parsers/Attic/AbstractSAXParser.java
Index: AbstractSAXParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Attic/AbstractSAXParser.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- AbstractSAXParser.java 2001/02/14 02:10:30 1.1.2.3
+++ AbstractSAXParser.java 2001/02/16 08:05:48 1.1.2.4
@@ -88,7 +88,7 @@
* @author Stubs generated by DesignDoc on Mon Sep 11 11:10:57 PDT 2000
* @author Andy Clark, IBM
*
- * @version $Id: AbstractSAXParser.java,v 1.1.2.3 2001/02/14 02:10:30 lehors Exp $ */
+ * @version $Id: AbstractSAXParser.java,v 1.1.2.4 2001/02/16 08:05:48 andyc Exp $ */
public abstract class AbstractSAXParser
extends AbstractXMLDocumentParser
implements Parser, XMLReader // SAX1, SAX2
@@ -142,9 +142,18 @@
/**
* The start of the document.
*
+ * @param systemId The system identifier of the entity if the entity
+ * is external, null otherwise.
+ * @param encoding The auto-detected IANA encoding name of the entity
+ * stream. This value will be null in those situations
+ * where the entity encoding is not auto-detected (e.g.
+ * internal entities or a document entity that is
+ * parsed from a java.io.Reader).
+ *
* @throws SAXException Thrown by handler to signal an error.
*/
- public void startDocument() throws SAXException {
+ public void startDocument(String systemId, String encoding)
+ throws SAXException {
// SAX1
if (fDocumentHandler != null) {
@@ -156,7 +165,7 @@
fContentHandler.startDocument();
}
- } // startDocument()
+ } // startDocument(String,String)
/**
* Notifies of the presence of the DOCTYPE line in the document.
@@ -235,6 +244,10 @@
*/
public void characters(XMLString text) throws SAXException {
+ if (fInDTD) {
+ return;
+ }
+
// SAX1
if (fDocumentHandler != null) {
fDocumentHandler.characters(text.ch, text.offset, text.length);
@@ -338,16 +351,9 @@
//
/**
- * This method notifies of the start of an entity. The document entity
- * has the pseudo-name of "[xml]"; The DTD has the pseudo-name of "[dtd];
- * parameter entity names start with '%'; and general entity names are
- * just the entity name.
- * <p>
- * <strong>Note:</strong> Since the document is an entity, the handler
- * will be notified of the start of the document entity by calling the
- * startEntity method with the entity name "[xml]" <em>before</em> calling
- * the startDocument method. When exposing entity boundaries through the
- * SAX API, the document entity is never reported, however.
+ * This method notifies of the start of an entity. The DTD has the
+ * pseudo-name of "[dtd]; parameter entity names start with '%'; and
+ * general entity names are just the entity name.
* <p>
* <strong>Note:</strong> Since the DTD is an entity, the handler
* will be notified of the start of the DTD entity by calling the
@@ -371,22 +377,15 @@
*/
public void startEntity(String name, String publicId, String systemId,
String encoding) throws SAXException {
- if (fLexicalHandler != null && !name.equals("[xml]")) {
+ if (fLexicalHandler != null) {
fLexicalHandler.startEntity(name);
}
} // startEntity(String,String,String,String)
/**
- * This method notifies the end of an entity. The document entity has
- * the pseudo-name of "[xml]"; the DTD has the pseudo-name of "[dtd];
- * parameter entity names start with '%'; and general entity names are
- * just the entity name.
- * <p>
- * <strong>Note:</strong> Since the document is an entity, the handler
- * will be notified of the end of the document entity by calling the
- * endEntity method with the entity name "[xml]" <em>after</em> calling
- * the endDocument method. When exposing entity boundaries through the
- * SAX API, the document entity is never reported, however.
+ * This method notifies the end of an entity. The DTD has the pseudo-name
+ * of "[dtd]; parameter entity names start with '%'; and general entity
+ * names are just the entity name.
* <p>
* <strong>Note:</strong> Since the DTD is an entity, the handler
* will be notified of the end of the DTD entity by calling the
@@ -401,7 +400,7 @@
* @throws SAXException Thrown by handler to signal an error.
*/
public void endEntity(String name) throws SAXException {
- if (fLexicalHandler != null && !name.equals("[xml]")) {
+ if (fLexicalHandler != null) {
fLexicalHandler.endEntity(name);
}
} // endEntity(String)
1.1.2.2 +49 -3 xml-xerces/java/src/org/apache/xerces/parsers/Attic/AbstractXMLDocumentParser.java
Index: AbstractXMLDocumentParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Attic/AbstractXMLDocumentParser.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- AbstractXMLDocumentParser.java 2001/02/14 02:10:30 1.1.2.1
+++ AbstractXMLDocumentParser.java 2001/02/16 08:05:48 1.1.2.2
@@ -91,7 +91,7 @@
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
*
- * @version $Id: AbstractXMLDocumentParser.java,v 1.1.2.1 2001/02/14 02:10:30 lehors Exp $
+ * @version $Id: AbstractXMLDocumentParser.java,v 1.1.2.2 2001/02/16 08:05:48 andyc Exp $
*/
public abstract class AbstractXMLDocumentParser
extends XMLParser
@@ -110,6 +110,11 @@
*/
protected boolean fParseInProgress = false;
+ // state
+
+ /** True if inside DTD. */
+ protected boolean fInDTD;
+
//
// Constructors
//
@@ -137,10 +142,19 @@
/**
* The start of the document.
*
+ * @param systemId The system identifier of the entity if the entity
+ * is external, null otherwise.
+ * @param encoding The auto-detected IANA encoding name of the entity
+ * stream. This value will be null in those situations
+ * where the entity encoding is not auto-detected (e.g.
+ * internal entities or a document entity that is
+ * parsed from a java.io.Reader).
+ *
* @throws SAXException Thrown by handler to signal an error.
*/
- public void startDocument() throws SAXException {
- } // startDocument()
+ public void startDocument(String systemId, String encoding)
+ throws SAXException {
+ } // startDocument(String,String)
/**
* Notifies of the presence of an XMLDecl line in the document. If
@@ -201,6 +215,22 @@
} // startElement(QName,XMLAttributes)
/**
+ * An empty element.
+ *
+ * @param element The name of the element.
+ * @param attributes The element attributes.
+ *
+ * @throws SAXException Thrown by handler to signal an error.
+ */
+ public void emptyElement(QName element, XMLAttributes attributes)
+ throws SAXException {
+
+ startElement(element, attributes);
+ endElement(element);
+
+ } // emptyElement(QName,XMLAttributes)
+
+ /**
* Character content.
*
* @param text The content.
@@ -396,6 +426,7 @@
* @throws SAXException Thrown by handler to signal an error.
*/
public void startDTD() throws SAXException {
+ fInDTD = true;
} // startDTD()
/**
@@ -547,6 +578,7 @@
* @throws SAXException Thrown by handler to signal an error.
*/
public void endDTD() throws SAXException {
+ fInDTD = false;
} // endDTD()
//
@@ -673,5 +705,19 @@
*/
public void endContentModel() throws SAXException {
} // endContentModel()
+
+ //
+ // Protected methods
+ //
+
+ /**
+ * reset all components before parsing
+ */
+ protected void reset() throws SAXException {
+ super.reset();
+
+ fInDTD = false;
+
+ } // reset()
} // class AbstractXMLDocumentParser
1.19.2.14 +4 -4 xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java
Index: DOMParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java,v
retrieving revision 1.19.2.13
retrieving revision 1.19.2.14
diff -u -r1.19.2.13 -r1.19.2.14
--- DOMParser.java 2001/02/14 02:10:30 1.19.2.13
+++ DOMParser.java 2001/02/16 08:05:48 1.19.2.14
@@ -85,7 +85,7 @@
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
*
- * @version $Id: DOMParser.java,v 1.19.2.13 2001/02/14 02:10:30 lehors Exp $ */
+ * @version $Id: DOMParser.java,v 1.19.2.14 2001/02/16 08:05:48 andyc Exp $ */
public class DOMParser
extends AbstractDOMParser {
@@ -185,7 +185,7 @@
fScanner = createDocumentScanner();
fProperties.put(DOCUMENT_SCANNER, fScanner);
}
- fComponents.add(fScanner);
+ fComponents.addElement(fScanner);
final String DTD_SCANNER = Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_SCANNER_PROPERTY;
fDTDScanner = (XMLDTDScanner) fProperties.get(DTD_SCANNER);
@@ -193,7 +193,7 @@
fDTDScanner = createDTDScanner();
fProperties.put(DTD_SCANNER, fDTDScanner);
}
- fComponents.add(fDTDScanner);
+ fComponents.addElement(fDTDScanner);
final String VALIDATOR = Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATOR_PROPERTY;
fValidator = (XMLValidator) fProperties.get(VALIDATOR);
@@ -201,7 +201,7 @@
fValidator = createValidator();
fProperties.put(VALIDATOR, fValidator);
}
- fComponents.add(fValidator);
+ fComponents.addElement(fValidator);
final String DATATYPE_VALIDATOR_FACTORY = Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYPE_VALIDATOR_FACTORY_PROPERTY;
fDatatypeValidatorFactory = (DatatypeValidatorFactory)
1.6.4.2 +3 -0 xml-xerces/java/src/org/apache/xerces/parsers/Makefile
Index: Makefile
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Makefile,v
retrieving revision 1.6.4.1
retrieving revision 1.6.4.2
diff -u -r1.6.4.1 -r1.6.4.2
--- Makefile 2000/10/02 01:01:53 1.6.4.1
+++ Makefile 2001/02/16 08:05:49 1.6.4.2
@@ -1,6 +1,9 @@
# Makefile for directory ./org/apache/xerces/parsers
TARGETS=\
+ AbstractDOMParser.class\
+ AbstractSAXParser.class\
+ AbstractXMLDocumentParser.class\
CachingParserPool.class\
DOMParser.class\
DTDParser.class\
1.12.2.21 +4 -4 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.20
retrieving revision 1.12.2.21
diff -u -r1.12.2.20 -r1.12.2.21
--- SAXParser.java 2001/02/14 02:10:31 1.12.2.20
+++ SAXParser.java 2001/02/16 08:05:49 1.12.2.21
@@ -85,7 +85,7 @@
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
*
- * @version $Id: SAXParser.java,v 1.12.2.20 2001/02/14 02:10:31 lehors Exp $ */
+ * @version $Id: SAXParser.java,v 1.12.2.21 2001/02/16 08:05:49 andyc Exp $ */
public class SAXParser
extends AbstractSAXParser {
@@ -184,7 +184,7 @@
fScanner = createDocumentScanner();
fProperties.put(DOCUMENT_SCANNER, fScanner);
}
- fComponents.add(fScanner);
+ fComponents.addElement(fScanner);
final String DTD_SCANNER = Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_SCANNER_PROPERTY;
fDTDScanner = (XMLDTDScanner) fProperties.get(DTD_SCANNER);
@@ -192,7 +192,7 @@
fDTDScanner = createDTDScanner();
fProperties.put(DTD_SCANNER, fDTDScanner);
}
- fComponents.add(fDTDScanner);
+ fComponents.addElement(fDTDScanner);
final String VALIDATOR = Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATOR_PROPERTY;
fValidator = (XMLValidator) fProperties.get(VALIDATOR);
@@ -200,7 +200,7 @@
fValidator = createValidator();
fProperties.put(VALIDATOR, fValidator);
}
- fComponents.add(fValidator);
+ fComponents.addElement(fValidator);
final String DATATYPE_VALIDATOR_FACTORY = Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYPE_VALIDATOR_FACTORY_PROPERTY;
fDatatypeValidatorFactory = (DatatypeValidatorFactory)
1.1.2.35 +4 -4 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.34
retrieving revision 1.1.2.35
diff -u -r1.1.2.34 -r1.1.2.35
--- XMLDocumentParser.java 2001/02/14 02:26:09 1.1.2.34
+++ XMLDocumentParser.java 2001/02/16 08:05:49 1.1.2.35
@@ -85,7 +85,7 @@
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
*
- * @version $Id: XMLDocumentParser.java,v 1.1.2.34 2001/02/14 02:26:09 lehors Exp $ */
+ * @version $Id: XMLDocumentParser.java,v 1.1.2.35 2001/02/16 08:05:49 andyc Exp $ */
public class XMLDocumentParser
extends AbstractXMLDocumentParser {
@@ -186,7 +186,7 @@
fScanner = createDocumentScanner();
fProperties.put(DOCUMENT_SCANNER, fScanner);
}
- fComponents.add(fScanner);
+ fComponents.addElement(fScanner);
final String DTD_SCANNER = Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_SCANNER_PROPERTY;
fDTDScanner = (XMLDTDScanner) fProperties.get(DTD_SCANNER);
@@ -194,7 +194,7 @@
fDTDScanner = createDTDScanner();
fProperties.put(DTD_SCANNER, fDTDScanner);
}
- fComponents.add(fDTDScanner);
+ fComponents.addElement(fDTDScanner);
final String VALIDATOR = Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATOR_PROPERTY;
fValidator = (XMLValidator) fProperties.get(VALIDATOR);
@@ -202,7 +202,7 @@
fValidator = createValidator();
fProperties.put(VALIDATOR, fValidator);
}
- fComponents.add(fValidator);
+ fComponents.addElement(fValidator);
final String DATATYPE_VALIDATOR_FACTORY = Constants.XERCES_PROPERTY_PREFIX + Constants.DATATYPE_VALIDATOR_FACTORY_PROPERTY;
fDatatypeValidatorFactory = (DatatypeValidatorFactory)
1.1.2.21 +3 -3 xml-xerces/java/src/org/apache/xerces/parsers/Attic/XMLParser.java
Index: XMLParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/Attic/XMLParser.java,v
retrieving revision 1.1.2.20
retrieving revision 1.1.2.21
diff -u -r1.1.2.20 -r1.1.2.21
--- XMLParser.java 2001/02/14 02:10:31 1.1.2.20
+++ XMLParser.java 2001/02/16 08:05:49 1.1.2.21
@@ -107,7 +107,7 @@
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
*
- * @version $Id: XMLParser.java,v 1.1.2.20 2001/02/14 02:10:31 lehors Exp $
+ * @version $Id: XMLParser.java,v 1.1.2.21 2001/02/16 08:05:49 andyc Exp $
*/
public abstract class XMLParser
implements XMLComponentManager {
@@ -220,7 +220,7 @@
fEntityManager = createEntityManager();
fProperties.put(ENTITY_MANAGER, fEntityManager);
}
- fComponents.add(fEntityManager);
+ fComponents.addElement(fEntityManager);
final String ERROR_REPORTER = Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
fErrorReporter = (XMLErrorReporter) fProperties.get(ERROR_REPORTER);
@@ -229,7 +229,7 @@
createErrorReporter(fEntityManager.getEntityScanner());
fProperties.put(ERROR_REPORTER, fErrorReporter);
}
- fComponents.add(fErrorReporter);
+ fComponents.addElement(fErrorReporter);
fLocator = (Locator) fEntityManager.getEntityScanner();
No revision
No revision
1.1.2.10 +8 -1 xml-xerces/java/src/org/apache/xerces/xni/Attic/XMLDTDHandler.java
Index: XMLDTDHandler.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/xni/Attic/XMLDTDHandler.java,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -r1.1.2.9 -r1.1.2.10
--- XMLDTDHandler.java 2000/10/13 21:24:39 1.1.2.9
+++ XMLDTDHandler.java 2001/02/16 08:05:51 1.1.2.10
@@ -77,7 +77,7 @@
* @author Stubs generated by DesignDoc on Mon Sep 18 18:23:16 PDT 2000
* @author Andy Clark, IBM
*
- * @version $Id: XMLDTDHandler.java,v 1.1.2.9 2000/10/13 21:24:39 andyc Exp $
+ * @version $Id: XMLDTDHandler.java,v 1.1.2.10 2001/02/16 08:05:51 andyc Exp $
*/
public interface XMLDTDHandler {
@@ -293,6 +293,13 @@
* @see CONDITIONAL_IGNORE
*/
public void startConditional(short type) throws SAXException;
+
+ /**
+ * Characters within an IGNORE conditional section.
+ *
+ * @param text The ignored text.
+ */
+ public void characters(XMLString text) throws SAXException;
/**
* The end of a conditional section.
1.1.2.8 +25 -23 xml-xerces/java/src/org/apache/xerces/xni/Attic/XMLDocumentHandler.java
Index: XMLDocumentHandler.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/xni/Attic/XMLDocumentHandler.java,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -r1.1.2.7 -r1.1.2.8
--- XMLDocumentHandler.java 2000/10/13 21:24:40 1.1.2.7
+++ XMLDocumentHandler.java 2001/02/16 08:05:51 1.1.2.8
@@ -78,7 +78,7 @@
* @author Stubs generated by DesignDoc on Mon Sep 18 18:23:16 PDT 2000
* @author Andy Clark, IBM
*
- * @version $Id: XMLDocumentHandler.java,v 1.1.2.7 2000/10/13 21:24:40 andyc Exp $
+ * @version $Id: XMLDocumentHandler.java,v 1.1.2.8 2001/02/16 08:05:51 andyc Exp $
*/
public interface XMLDocumentHandler {
@@ -87,16 +87,8 @@
//
/**
- * This method notifies the start of an entity. The document entity has
- * the pseudo-name of "[xml]"; and general entities are just specified
- * by their name.
+ * This method notifies the start of an entity.
* <p>
- * <strong>Note:</strong> Since the document is an entity, the handler
- * will be notified of the start of the document entity by calling the
- * startEntity method with the entity name "[xml]" <em>before</em> calling
- * the startDocument method. When exposing entity boundaries through the
- * SAX API, the document entity is never reported, however.
- * <p>
* <strong>Note:</strong> This method is not called for entity references
* appearing as part of attribute values.
*
@@ -137,9 +129,18 @@
/**
* The start of the document.
*
+ * @param systemId The system identifier of the entity if the entity
+ * is external, null otherwise.
+ * @param encoding The auto-detected IANA encoding name of the entity
+ * stream. This value will be null in those situations
+ * where the entity encoding is not auto-detected (e.g.
+ * internal entities or a document entity that is
+ * parsed from a java.io.Reader).
+ *
* @throws SAXException Thrown by handler to signal an error.
*/
- public void startDocument() throws SAXException;
+ public void startDocument(String systemId, String encoding)
+ throws SAXException;
/**
* Notifies of the presence of an XMLDecl line in the document. If
@@ -211,9 +212,7 @@
throws SAXException;
/**
- * The start of an element. If the document specifies the start element
- * by using an empty tag, then the startElement method will immediately
- * be followed by the endElement method, with no intervening methods.
+ * The start of an element.
*
* @param element The name of the element.
* @param attributes The element attributes.
@@ -224,6 +223,17 @@
throws SAXException;
/**
+ * An empty element.
+ *
+ * @param element The name of the element.
+ * @param attributes The element attributes.
+ *
+ * @throws SAXException Thrown by handler to signal an error.
+ */
+ public void emptyElement(QName element, XMLAttributes attributes)
+ throws SAXException;
+
+ /**
* Character content.
*
* @param text The content.
@@ -287,15 +297,7 @@
public void endDocument() throws SAXException;
/**
- * This method notifies the end of an entity. The document entity has
- * the pseudo-name of "[xml]"; and general entities are just specified
- * by their name.
- * <p>
- * <strong>Note:</strong> Since the document is an entity, the handler
- * will be notified of the end of the document entity by calling the
- * endEntity method with the entity name "[xml]" <em>after</em> calling
- * the endDocument method. When exposing entity boundaries through the
- * SAX API, the document entity is never reported, however.
+ * This method notifies the end of an entity.
* <p>
* <strong>Note:</strong> This method is not called for entity references
* appearing as part of attribute values.