sboag 01/06/18 13:51:55
Modified: java/src/org/apache/xalan/transformer
TransformerIdentityImpl.java
Log:
Wait to flush startDocument until the another event (like startElement) is
seen. This fixes problems with the xml header being sent out to
the result stream before the serializer is switched when the first
element is HTML.
Revision Changes Path
1.13 +21 -3
xml-xalan/java/src/org/apache/xalan/transformer/TransformerIdentityImpl.java
Index: TransformerIdentityImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformerIdentityImpl.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TransformerIdentityImpl.java 2001/05/08 16:24:58 1.12
+++ TransformerIdentityImpl.java 2001/06/18 20:51:46 1.13
@@ -862,10 +862,20 @@
throw new SAXException(te.getMessage(), te);
}
- m_resultContentHandler.startDocument();
-
m_foundFirstElement = false;
}
+
+ boolean m_flushedStartDoc = false;
+
+ protected final void flushStartDoc()
+ throws SAXException
+ {
+ if(!m_flushedStartDoc)
+ {
+ m_resultContentHandler.startDocument();
+ m_flushedStartDoc = true;
+ }
+ }
/**
* Receive notification of the end of the document.
@@ -883,6 +893,7 @@
*/
public void endDocument() throws SAXException
{
+ flushStartDoc();
m_resultContentHandler.endDocument();
}
@@ -904,6 +915,7 @@
public void startPrefixMapping(String prefix, String uri)
throws SAXException
{
+ flushStartDoc();
m_resultContentHandler.startPrefixMapping(prefix, uri);
}
@@ -923,6 +935,7 @@
*/
public void endPrefixMapping(String prefix) throws SAXException
{
+ flushStartDoc();
m_resultContentHandler.endPrefixMapping(prefix);
}
@@ -990,7 +1003,7 @@
m_serializer = newSerializer;
}
}
-
+ flushStartDoc();
m_resultContentHandler.startElement(uri, localName, qName, attributes);
}
@@ -1044,6 +1057,7 @@
*/
public void characters(char ch[], int start, int length) throws
SAXException
{
+ flushStartDoc();
m_resultContentHandler.characters(ch, start, length);
}
@@ -1091,6 +1105,7 @@
public void processingInstruction(String target, String data)
throws SAXException
{
+ flushStartDoc();
m_resultContentHandler.processingInstruction(target, data);
}
@@ -1111,6 +1126,7 @@
*/
public void skippedEntity(String name) throws SAXException
{
+ flushStartDoc();
m_resultContentHandler.skippedEntity(name);
}
@@ -1138,6 +1154,7 @@
public void startDTD(String name, String publicId, String systemId)
throws SAXException
{
+ flushStartDoc();
if (null != m_resultLexicalHandler)
m_resultLexicalHandler.startDTD(name, publicId, systemId);
}
@@ -1237,6 +1254,7 @@
*/
public void comment(char ch[], int start, int length) throws SAXException
{
+ flushStartDoc();
if (null != m_resultLexicalHandler)
m_resultLexicalHandler.comment(ch, start, length);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]