You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by zo...@apache.org on 2002/08/06 16:40:09 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/trax TransformerHandlerImpl.java
zongaro 2002/08/06 07:40:09
Modified: java/src/org/apache/xalan/xsltc/trax Tag: XSLTC_DTM
TransformerHandlerImpl.java
Log:
Code was using the system ID to construct a new StreamSource, and passed that
in to the DTM Manager's getDTM method. That causes the DTM Manager to
construct a new parser from which a DTM is constructed, meaning that the SAX
events coming into the TransformerHandlerImpl weren't being used to construct
the DTM - in fact, they caused problems because the document was supposed to
already have been parsed. Further, the system ID might not even correspond to
a physical document to be parsed. Passing a null argument to getDTM signals
that the DTM should be constructed from the SAX events that pass through the
TransformerHandlerImpl object.
Also changed code to remove order dependency between setting of a document
locator and creation of a DOMBuilder (_handler).
Revision Changes Path
No revision
No revision
1.6.10.3 +15 -14 xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerHandlerImpl.java
Index: TransformerHandlerImpl.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerHandlerImpl.java,v
retrieving revision 1.6.10.2
retrieving revision 1.6.10.3
diff -u -r1.6.10.2 -r1.6.10.3
--- TransformerHandlerImpl.java 29 Jul 2002 00:01:29 -0000 1.6.10.2
+++ TransformerHandlerImpl.java 6 Aug 2002 14:40:09 -0000 1.6.10.3
@@ -92,6 +92,7 @@
private DOMBuilder _handler = null;
private DTDMonitor _dtd = null;
private Result _result = null;
+ private Locator _locator = null;
private boolean _done = false; // Set in endDocument()
@@ -105,14 +106,6 @@
// Get a reference to the translet wrapped inside the transformer
_translet = _transformer.getTranslet();
- // Create a DOMBuilder object and get the handler
-/*
-%HZ% This just moved to the constructor from startDocument - now we're
-%HZ% moving the equivale thing back again. Is that absolutely required?
- _dom = new DOMImpl();
- _handler = _dom.getBuilder();
-*/
-
// Create a new DTD monitor
_dtd = new DTDMonitor();
}
@@ -192,14 +185,18 @@
}
// Create an internal DOM (not W3C) and get SAX2 input handler
- DTMManager dtmManager = XSLTCDTMManager.newInstance(
- org.apache.xpath.objects.XMLStringFactoryImpl.getFactory());
- _dom = (SAXImpl)dtmManager.getDTM(new StreamSource(_systemId), false,
- null, true, true);
+ DTMManager dtmManager = XSLTCDTMManager.newInstance(
+ org.apache.xpath.objects.XMLStringFactoryImpl.getFactory());
+
+ // Construct the DTM using the SAX events that come through
+ _dom = (SAXImpl)dtmManager.getDTM(null, false, null, true, true);
_handler = _dom.getBuilder();
+ if (_locator != null) {
+ _handler.setDocumentLocator(_locator);
+ }
+
// Proxy call
- // wondering if I need this. I think it would get called during DTM build...
_handler.startDocument();
}
@@ -297,7 +294,11 @@
* Receive an object for locating the origin of SAX document events.
*/
public void setDocumentLocator(Locator locator) {
- _handler.setDocumentLocator(locator);
+ _locator = locator;
+
+ if (_handler != null) {
+ _handler.setDocumentLocator(locator);
+ }
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org