cziegeler 2002/08/26 04:13:47
Modified: src/java/org/apache/cocoon/components/sax
XMLByteStreamCompiler.java
XMLByteStreamInterpreter.java
Log:
Adding all events to the compiled XML. This should fix bug 11943
Revision Changes Path
1.7 +28 -20
xml-cocoon2/src/java/org/apache/cocoon/components/sax/XMLByteStreamCompiler.java
Index: XMLByteStreamCompiler.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/sax/XMLByteStreamCompiler.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XMLByteStreamCompiler.java 10 Jul 2002 10:25:02 -0000 1.6
+++ XMLByteStreamCompiler.java 26 Aug 2002 11:13:47 -0000 1.7
@@ -78,8 +78,6 @@
/** The number of valid bytes in the buffer. */
private int bufCount;
- private boolean inDTD = false;
-
public XMLByteStreamCompiler() {
this.map = new HashMap();
this.initOutput();
@@ -113,6 +111,13 @@
private static final int PROCESSING_INSTRUCTION = 8;
private static final int COMMENT = 9;
private static final int LOCATOR = 10;
+ private static final int START_DTD = 11;
+ private static final int END_DTD = 12;
+ private static final int START_CDATA = 13;
+ private static final int END_CDATA = 14;
+ private static final int SKIPPED_ENTITY = 15;
+ private static final int START_ENTITY = 16;
+ private static final int END_ENTITY = 17;
public Object getSAXFragment() {
@@ -200,51 +205,56 @@
}
public void skippedEntity(java.lang.String name) throws SAXException {
- // ignore.
+ this.writeEvent(SKIPPED_ENTITY);
+ this.writeString(name);
}
/**
* SAX Event Handling: LexicalHandler
*/
- public void startDTD(String name, String public_id, String system_id) {
- // ignore
- inDTD = true;
+ public void startDTD(String name, String publicId, String systemId)
+ throws SAXException {
+ this.writeEvent(START_DTD);
+ this.writeString(name);
+ this.writeString(publicId!=null?publicId:"");
+ this.writeString(systemId!=null?systemId:"");
}
/**
* SAX Event Handling: LexicalHandler
*/
public void endDTD() throws SAXException {
- // ignore
- inDTD = false;
+ this.writeEvent(END_DTD);
}
/**
* SAX Event Handling: LexicalHandler
*/
public void startEntity(String name) throws SAXException {
- // ignore
+ this.writeEvent(START_ENTITY);
+ this.writeString(name);
}
/**
* SAX Event Handling: LexicalHandler
*/
public void endEntity(String name) throws SAXException {
- // ignore
+ this.writeEvent(END_ENTITY);
+ this.writeString(name);
}
/**
* SAX Event Handling: LexicalHandler
*/
public void startCDATA() throws SAXException {
- // ignore
+ this.writeEvent(START_CDATA);
}
/**
* SAX Event Handling: LexicalHandler
*/
public void endCDATA() throws SAXException {
- // ignore
+ this.writeEvent(END_CDATA);
}
@@ -253,13 +263,11 @@
*/
public void comment(char ary[], int start, int length)
throws SAXException {
- if (!inDTD) {
- try {
- this.writeEvent(COMMENT);
- this.writeChars(ary, start, length);
- } catch (Exception e) {
- throw new SAXException(e);
- }
+ try {
+ this.writeEvent(COMMENT);
+ this.writeChars(ary, start, length);
+ } catch (Exception e) {
+ throw new SAXException(e);
}
}
1.9 +31 -1
xml-cocoon2/src/java/org/apache/cocoon/components/sax/XMLByteStreamInterpreter.java
Index: XMLByteStreamInterpreter.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/sax/XMLByteStreamInterpreter.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XMLByteStreamInterpreter.java 6 Aug 2002 09:37:59 -0000 1.8
+++ XMLByteStreamInterpreter.java 26 Aug 2002 11:13:47 -0000 1.9
@@ -81,6 +81,13 @@
private static final int PROCESSING_INSTRUCTION = 8;
private static final int COMMENT = 9;
private static final int LOCATOR = 10;
+ private static final int START_DTD = 11;
+ private static final int END_DTD = 12;
+ private static final int START_CDATA = 13;
+ private static final int END_CDATA = 14;
+ private static final int SKIPPED_ENTITY = 15;
+ private static final int START_ENTITY = 16;
+ private static final int END_ENTITY = 17;
private ArrayList list = new ArrayList();
private byte[] input;
@@ -165,6 +172,29 @@
locator.setColumnNumber(columnNumber);
contentHandler.setDocumentLocator(locator);
}
+ break;
+ case START_DTD:
+ lexicalHandler.startDTD(this.readString(),
+ this.readString(),
+ this.readString());
+ break;
+ case END_DTD:
+ lexicalHandler.endDTD();
+ break;
+ case START_CDATA:
+ lexicalHandler.startCDATA();
+ break;
+ case END_CDATA:
+ lexicalHandler.endCDATA();
+ break;
+ case SKIPPED_ENTITY:
+ contentHandler.skippedEntity( this.readString() );
+ break;
+ case START_ENTITY:
+ lexicalHandler.startEntity( this.readString() );
+ break;
+ case END_ENTITY:
+ lexicalHandler.endEntity( this.readString() );
break;
default:
throw new SAXException ("parsing error: event not supported.");
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]