2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 * $Id: TransformerHandlerImpl.java 468645 2006-10-28 06:57:24Z minchau $
21 package org.apache.xalan.transformer;
23 import java.io.IOException;
25 import javax.xml.transform.Result;
26 import javax.xml.transform.Transformer;
27 import javax.xml.transform.sax.TransformerHandler;
29 import org.apache.xalan.res.XSLMessages;
30 import org.apache.xalan.res.XSLTErrorResources;
31 import org.apache.xml.dtm.DTM;
32 import org.apache.xml.dtm.DTMManager;
33 import org.apache.xml.dtm.ref.IncrementalSAXSource_Filter;
34 import org.apache.xml.dtm.ref.sax2dtm.SAX2DTM;
35 import org.apache.xpath.XPathContext;
37 import org.xml.sax.Attributes;
38 import org.xml.sax.ContentHandler;
39 import org.xml.sax.DTDHandler;
40 import org.xml.sax.EntityResolver;
41 import org.xml.sax.ErrorHandler;
42 import org.xml.sax.InputSource;
43 import org.xml.sax.Locator;
44 import org.xml.sax.SAXException;
45 import org.xml.sax.SAXParseException;
46 import org.xml.sax.ext.DeclHandler;
47 import org.xml.sax.ext.LexicalHandler;
48 import org.apache.xml.serializer.SerializationHandler;
52 * A TransformerHandler
53 * listens for SAX ContentHandler parse events and transforms
56 public class TransformerHandlerImpl
57 implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler,
58 LexicalHandler, TransformerHandler, DeclHandler
61 * The flag for the setting of the optimize feature;
63 private final boolean m_optimizer;
66 * The flag for the setting of the incremental feature;
68 private final boolean m_incremental;
71 * The flag for the setting of the source_location feature;
73 private final boolean m_source_location;
75 private boolean m_insideParse = false;
77 ////////////////////////////////////////////////////////////////////
79 ////////////////////////////////////////////////////////////////////
82 * Construct a TransformerHandlerImpl.
84 * @param transformer Non-null reference to the Xalan transformer impl.
85 * @param doFragment True if the result should be a document fragement.
86 * @param baseSystemID The system ID to use as the base for relative URLs.
88 public TransformerHandlerImpl(TransformerImpl transformer,
89 boolean doFragment, String baseSystemID)
94 m_transformer = transformer;
95 m_baseSystemID = baseSystemID;
97 XPathContext xctxt = transformer.getXPathContext();
98 DTM dtm = xctxt.getDTM(null, true, transformer, true, true);
101 dtm.setDocumentBaseURI(baseSystemID);
103 m_contentHandler = dtm.getContentHandler();
104 m_dtdHandler = dtm.getDTDHandler();
105 m_entityResolver = dtm.getEntityResolver();
106 m_errorHandler = dtm.getErrorHandler();
107 m_lexicalHandler = dtm.getLexicalHandler();
108 m_incremental = transformer.getIncremental();
109 m_optimizer = transformer.getOptimize();
110 m_source_location = transformer.getSource_location();
114 * Do what needs to be done to shut down the CoRoutine management.
116 protected void clearCoRoutine()
118 clearCoRoutine(null);
122 * Do what needs to be done to shut down the CoRoutine management.
124 protected void clearCoRoutine(SAXException ex)
127 m_transformer.setExceptionThrown(ex);
129 if(m_dtm instanceof SAX2DTM)
132 System.err.println("In clearCoRoutine...");
135 SAX2DTM sax2dtm = ((SAX2DTM)m_dtm);
136 if(null != m_contentHandler
137 && m_contentHandler instanceof IncrementalSAXSource_Filter)
139 IncrementalSAXSource_Filter sp =
140 (IncrementalSAXSource_Filter)m_contentHandler;
141 // This should now be all that's needed.
142 sp.deliverMoreNodes(false);
145 sax2dtm.clearCoRoutine(true);
146 m_contentHandler = null;
148 m_entityResolver = null;
149 m_errorHandler = null;
150 m_lexicalHandler = null;
152 catch(Throwable throwable)
154 throwable.printStackTrace();
158 System.err.println("...exiting clearCoRoutine");
162 ////////////////////////////////////////////////////////////////////
163 // Implementation of javax.xml.transform.sax.TransformerHandler.
164 ////////////////////////////////////////////////////////////////////
167 * Enables the user of the TransformerHandler to set the
168 * to set the Result for the transformation.
170 * @param result A Result instance, should not be null.
172 * @throws IllegalArgumentException if result is invalid for some reason.
174 public void setResult(Result result) throws IllegalArgumentException
178 throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_NULL, null)); //"result should not be null");
182 // ContentHandler handler =
183 // m_transformer.createResultContentHandler(result);
184 // m_transformer.setContentHandler(handler);
185 SerializationHandler xoh =
186 m_transformer.createSerializationHandler(result);
187 m_transformer.setSerializationHandler(xoh);
189 catch (javax.xml.transform.TransformerException te)
191 throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_COULD_NOT_BE_SET, null)); //"result could not be set");
198 * Set the base ID (URI or system ID) from where relative
199 * URLs will be resolved.
200 * @param systemID Base URI for the source tree.
202 public void setSystemId(String systemID)
204 m_baseSystemID = systemID;
205 m_dtm.setDocumentBaseURI(systemID);
209 * Get the base ID (URI or system ID) from where relative
210 * URLs will be resolved.
211 * @return The systemID that was set with {@link #setSystemId}.
213 public String getSystemId()
215 return m_baseSystemID;
219 * Get the Transformer associated with this handler, which
220 * is needed in order to set parameters and output properties.
222 * @return The Transformer associated with this handler
224 public Transformer getTransformer()
226 return m_transformer;
229 ////////////////////////////////////////////////////////////////////
230 // Implementation of org.xml.sax.EntityResolver.
231 ////////////////////////////////////////////////////////////////////
234 * Filter an external entity resolution.
236 * @param publicId The entity's public identifier, or null.
237 * @param systemId The entity's system identifier.
238 * @return A new InputSource or null for the default.
240 * @throws IOException
241 * @throws SAXException The client may throw
242 * an exception during processing.
243 * @throws java.io.IOException The client may throw an
244 * I/O-related exception while obtaining the
246 * @see org.xml.sax.EntityResolver#resolveEntity
248 public InputSource resolveEntity(String publicId, String systemId)
249 throws SAXException, IOException
252 if (m_entityResolver != null)
254 return m_entityResolver.resolveEntity(publicId, systemId);
262 ////////////////////////////////////////////////////////////////////
263 // Implementation of org.xml.sax.DTDHandler.
264 ////////////////////////////////////////////////////////////////////
267 * Filter a notation declaration event.
269 * @param name The notation name.
270 * @param publicId The notation's public identifier, or null.
271 * @param systemId The notation's system identifier, or null.
272 * @throws SAXException The client may throw
273 * an exception during processing.
274 * @see org.xml.sax.DTDHandler#notationDecl
276 public void notationDecl(String name, String publicId, String systemId)
280 if (m_dtdHandler != null)
282 m_dtdHandler.notationDecl(name, publicId, systemId);
287 * Filter an unparsed entity declaration event.
289 * @param name The entity name.
290 * @param publicId The entity's public identifier, or null.
291 * @param systemId The entity's system identifier, or null.
292 * @param notationName The name of the associated notation.
293 * @throws SAXException The client may throw
294 * an exception during processing.
295 * @see org.xml.sax.DTDHandler#unparsedEntityDecl
297 public void unparsedEntityDecl(
298 String name, String publicId, String systemId, String notationName)
302 if (m_dtdHandler != null)
304 m_dtdHandler.unparsedEntityDecl(name, publicId, systemId, notationName);
308 ////////////////////////////////////////////////////////////////////
309 // Implementation of org.xml.sax.ContentHandler.
310 ////////////////////////////////////////////////////////////////////
313 * Filter a new document locator event.
315 * @param locator The document locator.
316 * @see org.xml.sax.ContentHandler#setDocumentLocator
318 public void setDocumentLocator(Locator locator)
322 System.out.println("TransformerHandlerImpl#setDocumentLocator: "
323 + locator.getSystemId());
325 this.m_locator = locator;
327 if(null == m_baseSystemID)
329 setSystemId(locator.getSystemId());
332 if (m_contentHandler != null)
334 m_contentHandler.setDocumentLocator(locator);
339 * Filter a start document event.
341 * @throws SAXException The client may throw
342 * an exception during processing.
343 * @see org.xml.sax.ContentHandler#startDocument
345 public void startDocument() throws SAXException
349 System.out.println("TransformerHandlerImpl#startDocument");
351 m_insideParse = true;
353 // Thread listener = new Thread(m_transformer);
355 if (m_contentHandler != null)
357 //m_transformer.setTransformThread(listener);
360 m_transformer.setSourceTreeDocForThread(m_dtm.getDocument());
362 int cpriority = Thread.currentThread().getPriority();
364 // runTransformThread is equivalent with the 2.0.1 code,
365 // except that the Thread may come from a pool.
366 m_transformer.runTransformThread( cpriority );
369 // This is now done _last_, because IncrementalSAXSource_Filter
370 // will immediately go into a "wait until events are requested"
371 // pause. I believe that will close our timing window.
373 m_contentHandler.startDocument();
376 //listener.setDaemon(false);
382 * Filter an end document event.
384 * @throws SAXException The client may throw
385 * an exception during processing.
386 * @see org.xml.sax.ContentHandler#endDocument
388 public void endDocument() throws SAXException
392 System.out.println("TransformerHandlerImpl#endDocument");
394 m_insideParse = false;
396 if (m_contentHandler != null)
398 m_contentHandler.endDocument();
403 m_transformer.waitTransformThread();
407 m_transformer.setSourceTreeDocForThread(m_dtm.getDocument());
410 /* Thread transformThread = m_transformer.getTransformThread();
412 if (null != transformThread)
417 // This should wait until the transformThread is considered not alive.
418 transformThread.join();
420 if (!m_transformer.hasTransformThreadErrorCatcher())
422 Exception e = m_transformer.getExceptionThrown();
425 throw new org.xml.sax.SAXException(e);
428 m_transformer.setTransformThread(null);
430 catch (InterruptedException ie){}
435 * Filter a start Namespace prefix mapping event.
437 * @param prefix The Namespace prefix.
438 * @param uri The Namespace URI.
439 * @throws SAXException The client may throw
440 * an exception during processing.
441 * @see org.xml.sax.ContentHandler#startPrefixMapping
443 public void startPrefixMapping(String prefix, String uri)
448 System.out.println("TransformerHandlerImpl#startPrefixMapping: "
449 + prefix + ", " + uri);
451 if (m_contentHandler != null)
453 m_contentHandler.startPrefixMapping(prefix, uri);
458 * Filter an end Namespace prefix mapping event.
460 * @param prefix The Namespace prefix.
461 * @throws SAXException The client may throw
462 * an exception during processing.
463 * @see org.xml.sax.ContentHandler#endPrefixMapping
465 public void endPrefixMapping(String prefix) throws SAXException
469 System.out.println("TransformerHandlerImpl#endPrefixMapping: "
472 if (m_contentHandler != null)
474 m_contentHandler.endPrefixMapping(prefix);
479 * Filter a start element event.
481 * @param uri The element's Namespace URI, or the empty string.
482 * @param localName The element's local name, or the empty string.
483 * @param qName The element's qualified (prefixed) name, or the empty
485 * @param atts The element's attributes.
486 * @throws SAXException The client may throw
487 * an exception during processing.
488 * @see org.xml.sax.ContentHandler#startElement
490 public void startElement(
491 String uri, String localName, String qName, Attributes atts)
496 System.out.println("TransformerHandlerImpl#startElement: " + qName);
498 if (m_contentHandler != null)
500 m_contentHandler.startElement(uri, localName, qName, atts);
505 * Filter an end element event.
507 * @param uri The element's Namespace URI, or the empty string.
508 * @param localName The element's local name, or the empty string.
509 * @param qName The element's qualified (prefixed) name, or the empty
511 * @throws SAXException The client may throw
512 * an exception during processing.
513 * @see org.xml.sax.ContentHandler#endElement
515 public void endElement(String uri, String localName, String qName)
520 System.out.println("TransformerHandlerImpl#endElement: " + qName);
522 if (m_contentHandler != null)
524 m_contentHandler.endElement(uri, localName, qName);
529 * Filter a character data event.
531 * @param ch An array of characters.
532 * @param start The starting position in the array.
533 * @param length The number of characters to use from the array.
534 * @throws SAXException The client may throw
535 * an exception during processing.
536 * @see org.xml.sax.ContentHandler#characters
538 public void characters(char ch[], int start, int length) throws SAXException
542 System.out.println("TransformerHandlerImpl#characters: " + start + ", "
545 if (m_contentHandler != null)
547 m_contentHandler.characters(ch, start, length);
552 * Filter an ignorable whitespace event.
554 * @param ch An array of characters.
555 * @param start The starting position in the array.
556 * @param length The number of characters to use from the array.
557 * @throws SAXException The client may throw
558 * an exception during processing.
559 * @see org.xml.sax.ContentHandler#ignorableWhitespace
561 public void ignorableWhitespace(char ch[], int start, int length)
566 System.out.println("TransformerHandlerImpl#ignorableWhitespace: "
567 + start + ", " + length);
569 if (m_contentHandler != null)
571 m_contentHandler.ignorableWhitespace(ch, start, length);
576 * Filter a processing instruction event.
578 * @param target The processing instruction target.
579 * @param data The text following the target.
580 * @throws SAXException The client may throw
581 * an exception during processing.
582 * @see org.xml.sax.ContentHandler#processingInstruction
584 public void processingInstruction(String target, String data)
589 System.out.println("TransformerHandlerImpl#processingInstruction: "
590 + target + ", " + data);
592 if (m_contentHandler != null)
594 m_contentHandler.processingInstruction(target, data);
599 * Filter a skipped entity event.
601 * @param name The name of the skipped entity.
602 * @throws SAXException The client may throw
603 * an exception during processing.
604 * @see org.xml.sax.ContentHandler#skippedEntity
606 public void skippedEntity(String name) throws SAXException
610 System.out.println("TransformerHandlerImpl#skippedEntity: " + name);
612 if (m_contentHandler != null)
614 m_contentHandler.skippedEntity(name);
618 ////////////////////////////////////////////////////////////////////
619 // Implementation of org.xml.sax.ErrorHandler.
620 ////////////////////////////////////////////////////////////////////
623 * Filter a warning event.
625 * @param e The nwarning as an exception.
626 * @throws SAXException The client may throw
627 * an exception during processing.
628 * @see org.xml.sax.ErrorHandler#warning
630 public void warning(SAXParseException e) throws SAXException
632 // This is not great, but we really would rather have the error
633 // handler be the error listener if it is a error handler. Coroutine's fatalError
634 // can't really be configured, so I think this is the best thing right now
635 // for error reporting. Possibly another JAXP 1.1 hole. -sb
636 javax.xml.transform.ErrorListener errorListener = m_transformer.getErrorListener();
637 if(errorListener instanceof ErrorHandler)
639 ((ErrorHandler)errorListener).warning(e);
645 errorListener.warning(new javax.xml.transform.TransformerException(e));
647 catch(javax.xml.transform.TransformerException te)
655 * Filter an error event.
657 * @param e The error as an exception.
658 * @throws SAXException The client may throw
659 * an exception during processing.
660 * @see org.xml.sax.ErrorHandler#error
662 public void error(SAXParseException e) throws SAXException
664 // %REVIEW% I don't think this should be called. -sb
665 // clearCoRoutine(e);
667 // This is not great, but we really would rather have the error
668 // handler be the error listener if it is a error handler. Coroutine's fatalError
669 // can't really be configured, so I think this is the best thing right now
670 // for error reporting. Possibly another JAXP 1.1 hole. -sb
671 javax.xml.transform.ErrorListener errorListener = m_transformer.getErrorListener();
672 if(errorListener instanceof ErrorHandler)
674 ((ErrorHandler)errorListener).error(e);
675 if(null != m_errorHandler)
676 m_errorHandler.error(e); // may not be called.
682 errorListener.error(new javax.xml.transform.TransformerException(e));
683 if(null != m_errorHandler)
684 m_errorHandler.error(e); // may not be called.
686 catch(javax.xml.transform.TransformerException te)
694 * Filter a fatal error event.
696 * @param e The error as an exception.
697 * @throws SAXException The client may throw
698 * an exception during processing.
699 * @see org.xml.sax.ErrorHandler#fatalError
701 public void fatalError(SAXParseException e) throws SAXException
703 if(null != m_errorHandler)
707 m_errorHandler.fatalError(e);
709 catch(SAXParseException se)
713 // clearCoRoutine(e);
716 // This is not great, but we really would rather have the error
717 // handler be the error listener if it is a error handler. Coroutine's fatalError
718 // can't really be configured, so I think this is the best thing right now
719 // for error reporting. Possibly another JAXP 1.1 hole. -sb
720 javax.xml.transform.ErrorListener errorListener = m_transformer.getErrorListener();
722 if(errorListener instanceof ErrorHandler)
724 ((ErrorHandler)errorListener).fatalError(e);
725 if(null != m_errorHandler)
726 m_errorHandler.fatalError(e); // may not be called.
732 errorListener.fatalError(new javax.xml.transform.TransformerException(e));
733 if(null != m_errorHandler)
734 m_errorHandler.fatalError(e); // may not be called.
736 catch(javax.xml.transform.TransformerException te)
743 ////////////////////////////////////////////////////////////////////
744 // Implementation of org.xml.sax.ext.LexicalHandler.
745 ////////////////////////////////////////////////////////////////////
748 * Report the start of DTD declarations, if any.
750 * <p>Any declarations are assumed to be in the internal subset
751 * unless otherwise indicated by a {@link #startEntity startEntity}
754 * <p>Note that the start/endDTD events will appear within
755 * the start/endDocument events from ContentHandler and
756 * before the first startElement event.</p>
758 * @param name The document type name.
759 * @param publicId The declared public identifier for the
760 * external DTD subset, or null if none was declared.
761 * @param systemId The declared system identifier for the
762 * external DTD subset, or null if none was declared.
763 * @throws SAXException The application may raise an
768 public void startDTD(String name, String publicId, String systemId)
773 System.out.println("TransformerHandlerImpl#startDTD: " + name + ", "
774 + publicId + ", " + systemId);
776 if (null != m_lexicalHandler)
778 m_lexicalHandler.startDTD(name, publicId, systemId);
783 * Report the end of DTD declarations.
785 * @throws SAXException The application may raise an exception.
788 public void endDTD() throws SAXException
792 System.out.println("TransformerHandlerImpl#endDTD");
794 if (null != m_lexicalHandler)
796 m_lexicalHandler.endDTD();
801 * Report the beginning of an entity in content.
803 * <p><strong>NOTE:</entity> entity references in attribute
804 * values -- and the start and end of the document entity --
805 * are never reported.</p>
807 * <p>The start and end of the external DTD subset are reported
808 * using the pseudo-name "[dtd]". All other events must be
809 * properly nested within start/end entity events.</p>
811 * <p>Note that skipped entities will be reported through the
812 * {@link org.xml.sax.ContentHandler#skippedEntity skippedEntity}
813 * event, which is part of the ContentHandler interface.</p>
815 * @param name The name of the entity. If it is a parameter
816 * entity, the name will begin with '%'.
817 * @throws SAXException The application may raise an exception.
819 * @see org.xml.sax.ext.DeclHandler#internalEntityDecl
820 * @see org.xml.sax.ext.DeclHandler#externalEntityDecl
822 public void startEntity(String name) throws SAXException
826 System.out.println("TransformerHandlerImpl#startEntity: " + name);
828 if (null != m_lexicalHandler)
830 m_lexicalHandler.startEntity(name);
835 * Report the end of an entity.
837 * @param name The name of the entity that is ending.
838 * @throws SAXException The application may raise an exception.
841 public void endEntity(String name) throws SAXException
845 System.out.println("TransformerHandlerImpl#endEntity: " + name);
847 if (null != m_lexicalHandler)
849 m_lexicalHandler.endEntity(name);
854 * Report the start of a CDATA section.
856 * <p>The contents of the CDATA section will be reported through
857 * the regular {@link org.xml.sax.ContentHandler#characters
858 * characters} event.</p>
860 * @throws SAXException The application may raise an exception.
863 public void startCDATA() throws SAXException
867 System.out.println("TransformerHandlerImpl#startCDATA");
869 if (null != m_lexicalHandler)
871 m_lexicalHandler.startCDATA();
876 * Report the end of a CDATA section.
878 * @throws SAXException The application may raise an exception.
881 public void endCDATA() throws SAXException
885 System.out.println("TransformerHandlerImpl#endCDATA");
887 if (null != m_lexicalHandler)
889 m_lexicalHandler.endCDATA();
894 * Report an XML comment anywhere in the document.
896 * <p>This callback will be used for comments inside or outside the
897 * document element, including comments in the external DTD
898 * subset (if read).</p>
900 * @param ch An array holding the characters in the comment.
901 * @param start The starting position in the array.
902 * @param length The number of characters to use from the array.
903 * @throws SAXException The application may raise an exception.
905 public void comment(char ch[], int start, int length) throws SAXException
909 System.out.println("TransformerHandlerImpl#comment: " + start + ", "
912 if (null != m_lexicalHandler)
914 m_lexicalHandler.comment(ch, start, length);
918 ////////////////////////////////////////////////////////////////////
919 // Implementation of org.xml.sax.ext.DeclHandler.
920 ////////////////////////////////////////////////////////////////////
923 * Report an element type declaration.
925 * <p>The content model will consist of the string "EMPTY", the
926 * string "ANY", or a parenthesised group, optionally followed
927 * by an occurrence indicator. The model will be normalized so
928 * that all whitespace is removed,and will include the enclosing
931 * @param name The element type name.
932 * @param model The content model as a normalized string.
933 * @throws SAXException The application may raise an exception.
935 public void elementDecl(String name, String model) throws SAXException
939 System.out.println("TransformerHandlerImpl#elementDecl: " + name + ", "
942 if (null != m_declHandler)
944 m_declHandler.elementDecl(name, model);
949 * Report an attribute type declaration.
951 * <p>Only the effective (first) declaration for an attribute will
952 * be reported. The type will be one of the strings "CDATA",
953 * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",
954 * "ENTITIES", or "NOTATION", or a parenthesized token group with
955 * the separator "|" and all whitespace removed.</p>
957 * @param eName The name of the associated element.
958 * @param aName The name of the attribute.
959 * @param type A string representing the attribute type.
960 * @param valueDefault A string representing the attribute default
961 * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
962 * none of these applies.
963 * @param value A string representing the attribute's default value,
964 * or null if there is none.
965 * @throws SAXException The application may raise an exception.
967 public void attributeDecl(
968 String eName, String aName, String type, String valueDefault, String value)
973 System.out.println("TransformerHandlerImpl#attributeDecl: " + eName
974 + ", " + aName + ", etc...");
976 if (null != m_declHandler)
978 m_declHandler.attributeDecl(eName, aName, type, valueDefault, value);
983 * Report an internal entity declaration.
985 * <p>Only the effective (first) declaration for each entity
986 * will be reported.</p>
988 * @param name The name of the entity. If it is a parameter
989 * entity, the name will begin with '%'.
990 * @param value The replacement text of the entity.
991 * @throws SAXException The application may raise an exception.
992 * @see #externalEntityDecl
993 * @see org.xml.sax.DTDHandler#unparsedEntityDecl
995 public void internalEntityDecl(String name, String value)
1000 System.out.println("TransformerHandlerImpl#internalEntityDecl: " + name
1003 if (null != m_declHandler)
1005 m_declHandler.internalEntityDecl(name, value);
1010 * Report a parsed external entity declaration.
1012 * <p>Only the effective (first) declaration for each entity
1013 * will be reported.</p>
1015 * @param name The name of the entity. If it is a parameter
1016 * entity, the name will begin with '%'.
1017 * @param publicId The declared public identifier of the entity, or
1018 * null if none was declared.
1019 * @param systemId The declared system identifier of the entity.
1020 * @throws SAXException The application may raise an exception.
1021 * @see #internalEntityDecl
1022 * @see org.xml.sax.DTDHandler#unparsedEntityDecl
1024 public void externalEntityDecl(
1025 String name, String publicId, String systemId) throws SAXException
1029 System.out.println("TransformerHandlerImpl#externalEntityDecl: " + name
1030 + ", " + publicId + ", " + systemId);
1032 if (null != m_declHandler)
1034 m_declHandler.externalEntityDecl(name, publicId, systemId);
1038 ////////////////////////////////////////////////////////////////////
1040 ////////////////////////////////////////////////////////////////////
1042 /** Set to true for diagnostics output. */
1043 private static boolean DEBUG = false;
1046 * The transformer this will use to transform a
1047 * source tree into a result tree.
1049 private TransformerImpl m_transformer;
1051 /** The system ID to use as a base for relative URLs. */
1052 private String m_baseSystemID;
1054 /** The result for the transformation. */
1055 private Result m_result = null;
1057 /** The locator for this TransformerHandler. */
1058 private Locator m_locator = null;
1060 /** The entity resolver to aggregate to. */
1061 private EntityResolver m_entityResolver = null;
1063 /** The DTD handler to aggregate to. */
1064 private DTDHandler m_dtdHandler = null;
1066 /** The content handler to aggregate to. */
1067 private ContentHandler m_contentHandler = null;
1069 /** The error handler to aggregate to. */
1070 private ErrorHandler m_errorHandler = null;
1072 /** The lexical handler to aggregate to. */
1073 private LexicalHandler m_lexicalHandler = null;
1075 /** The decl handler to aggregate to. */
1076 private DeclHandler m_declHandler = null;
1078 /** The Document Table Instance we are transforming. */