santiagopg 2002/06/11 08:18:47
Modified: java/src/org/apache/xalan/xsltc/trax DOM2SAX.java
Log:
Added comment() support.
Revision Changes Path
1.13 +12 -5
xml-xalan/java/src/org/apache/xalan/xsltc/trax/DOM2SAX.java
Index: DOM2SAX.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/DOM2SAX.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- DOM2SAX.java 24 Apr 2002 17:03:17 -0000 1.12
+++ DOM2SAX.java 11 Jun 2002 15:18:47 -0000 1.13
@@ -69,6 +69,7 @@
import org.xml.sax.XMLReader;
import org.xml.sax.ContentHandler;
+import org.xml.sax.ext.LexicalHandler;
import org.xml.sax.DTDHandler;
import org.xml.sax.Locator;
import org.xml.sax.ErrorHandler;
@@ -88,8 +89,6 @@
import org.w3c.dom.Entity;
import org.w3c.dom.Notation;
-// import org.apache.xalan.xsltc.runtime.AttributeList;
-
class DOM2SAX implements XMLReader, Locator {
private final static String EMPTYSTRING = "";
@@ -97,6 +96,7 @@
private Node _dom = null;
private ContentHandler _sax = null;
+ private LexicalHandler _lex = null;
private Hashtable _nsPrefixes = new Hashtable();
public DOM2SAX(Node root) {
@@ -110,8 +110,10 @@
public void setContentHandler(ContentHandler handler) throws
NullPointerException
{
- if (handler == null) throw new NullPointerException();
_sax = handler;
+ if (handler instanceof LexicalHandler) {
+ _lex = (LexicalHandler) handler;
+ }
}
/**
@@ -195,7 +197,6 @@
switch (node.getNodeType()) {
case Node.ATTRIBUTE_NODE: // handled by ELEMENT_NODE
- case Node.COMMENT_NODE: // should be handled!!!
case Node.CDATA_SECTION_NODE:
case Node.DOCUMENT_FRAGMENT_NODE:
case Node.DOCUMENT_TYPE_NODE :
@@ -205,6 +206,12 @@
// These node types are ignored!!!
break;
+ case Node.COMMENT_NODE: // should be handled!!!
+ if (_lex != null) {
+ final String value = node.getNodeValue();
+ _lex.comment(value.toCharArray(), 0, value.length());
+ }
+ break;
case Node.DOCUMENT_NODE:
_sax.setDocumentLocator(this);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]