mmidy 00/03/16 12:58:37
Modified: src/org/apache/xalan/xslt XSLTEngineImpl.java
Log:
Retrofit changes from the branch into the trunk.
Revision Changes Path
1.59 +125 -22 xml-xalan/src/org/apache/xalan/xslt/XSLTEngineImpl.java
Index: XSLTEngineImpl.java
===================================================================
RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/XSLTEngineImpl.java,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- XSLTEngineImpl.java 2000/03/16 17:33:39 1.58
+++ XSLTEngineImpl.java 2000/03/16 20:58:37 1.59
@@ -481,17 +481,17 @@
{
// If the result node is a xerces node, try to be smart about which
// liaison is going to be used.
-
- // Here's the logic:
-
- // Source - Result - What we do
- // ==========================================
- // DTM - Xerces DOM - error, you can't mix types
- // DTM - DTM - Do nothing, We're OK
- // Xerces DOM - DTM - error, you can't have DTM as a result
- // Xerces DOM - Xerces DOM - switch to Xerces Liaison
-
+
+ // Here's the logic:
+ // Source - Result - What we do
+ // ==========================================
+ // DTM - Xerces DOM - error, you can't mix types
+ // DTM - DTM - Do nothing, We're OK
+ // Xerces DOM - DTM - error, you can't have DTM as a result
+ // Xerces DOM - Xerces DOM - switch to Xerces Liaison
+
+
if((null != resultNode) && (resultNode instanceof
org.apache.xerces.dom.NodeImpl) &&
(m_parserLiaison instanceof org.apache.xalan.xpath.dtm.DTMLiaison))
{
@@ -511,9 +511,9 @@
if((null != resultNode)
&& (!(resultNode instanceof org.apache.xerces.dom.NodeImpl)))
{
- throw new SAXException("Can not mix Xerces-DOM input with non
Xerces-DOM output!");
+ throw new
SAXException(XSLMessages.createMessage(XSLTErrorResources.ER_CANNOT_MIX_XERCESDOM,
null)); //"Can not mix Xerces-DOM input with non Xerces-DOM output!");
}
-
+
XMLParserLiaison newLiaison = new
org.apache.xalan.xpath.xdom.XercesLiaison();
newLiaison.copyFromOtherLiaison((XMLParserLiaisonDefault)m_parserLiaison);
setExecContext(newLiaison);
@@ -3362,13 +3362,50 @@
m_sourceTreeHandler.endElement(name);
}
+ private boolean m_isCData = false;
+
+ /**
+ * Report the start of a CDATA section.
+ *
+ * <p>The contents of the CDATA section will be reported through
+ * the regular [EMAIL PROTECTED] org.xml.sax.ContentHandler#characters
+ * characters} event.</p>
+ *
+ * @exception SAXException The application may raise an exception.
+ * @see #endCDATA
+ */
+ public void startCDATA ()
+ throws SAXException
+ {
+ m_isCData = true;
+ }
+
+ /**
+ * Report the end of a CDATA section.
+ *
+ * @exception SAXException The application may raise an exception.
+ * @see #startCDATA
+ */
+ public void endCDATA ()
+ throws SAXException
+ {
+ m_isCData = false;
+ }
+
/**
* Implement the characters event.
*/
public void characters (char ch[], int start, int length)
throws SAXException
{
- m_sourceTreeHandler.characters(ch, start, length);
+ if(m_isCData)
+ {
+ m_sourceTreeHandler.cdata(ch, start, length);
+ }
+ else
+ {
+ m_sourceTreeHandler.characters(ch, start, length);
+ }
}
/**
@@ -3399,28 +3436,94 @@
}
/**
- * Implement the comment event.
+ * Report an XML comment anywhere in the document.
+ *
+ * <p>This callback will be used for comments inside or outside the
+ * document element, including comments in the external DTD
+ * subset (if read).</p>
+ *
+ * @param ch An array holding the characters in the comment.
+ * @param start The starting position in the array.
+ * @param length The number of characters to use from the array.
+ * @exception SAXException The application may raise an exception.
*/
- public void comment(String data) throws SAXException
+ public void comment (char ch[], int start, int length)
+ throws SAXException
+ {
+ m_sourceTreeHandler.comment(ch, start, length);
+ }
+
+ /**
+ * Report the beginning of an entity.
+ *
+ * <p>The start and end of the document entity are not reported.
+ * The start and end of the external DTD subset are reported
+ * using the pseudo-name "[dtd]". All other events must be
+ * properly nested within start/end entity events.</p>
+ *
+ * <p>Note that skipped entities will be reported through the
+ * [EMAIL PROTECTED] org.xml.sax.ContentHandler#skippedEntity
skippedEntity}
+ * event, which is part of the ContentHandler interface.</p>
+ *
+ * @param name The name of the entity. If it is a parameter
+ * entity, the name will begin with '%'.
+ * @exception SAXException The application may raise an exception.
+ * @see #endEntity
+ * @see org.xml.sax.ext.DeclHandler#internalEntityDecl
+ * @see org.xml.sax.ext.DeclHandler#externalEntityDecl
+ */
+ public void startEntity (String name)
+ throws SAXException
{
- m_sourceTreeHandler.comment(data.toCharArray(), 0, data.length());
+ m_sourceTreeHandler.startEntity(name);
}
/**
- * Implement the entityReference event.
+ * Report the end of an entity.
+ *
+ * @param name The name of the entity that is ending.
+ * @exception SAXException The application may raise an exception.
+ * @see #startEntity
+ */
+ public void endEntity (String name)
+ throws SAXException
+ {
+ m_sourceTreeHandler.endEntity(name);
+ }
+
+ /**
+ * Report the start of DTD declarations, if any.
+ *
+ * <p>Any declarations are assumed to be in the internal subset
+ * unless otherwise indicated by a [EMAIL PROTECTED] #startEntity
startEntity}
+ * event.</p>
+ *
+ * @param name The document type name.
+ * @param publicId The declared public identifier for the
+ * external DTD subset, or null if none was declared.
+ * @param systemId The declared system identifier for the
+ * external DTD subset, or null if none was declared.
+ * @exception SAXException The application may raise an
+ * exception.
+ * @see #endDTD
+ * @see #startEntity
*/
- public void entityReference(String name) throws SAXException
+ public void startDTD (String name, String publicId,
+ String systemId)
+ throws SAXException
{
- m_sourceTreeHandler.entityReference(name);
}
+
/**
- * Implement the cdata event.
+ * Report the end of DTD declarations.
+ *
+ * @exception SAXException The application may raise an exception.
+ * @see #startDTD
*/
- public void cdata (char ch[], int start, int length)
+ public void endDTD ()
throws SAXException
{
- m_sourceTreeHandler.cdata(ch, start, length);
}
/**