santiagopg    2002/06/19 12:24:49

  Modified:    java/src/org/apache/xalan/xsltc/runtime/output
                        SAXHTMLOutput.java StreamHTMLOutput.java
                        StreamOutput.java StreamUnknownOutput.java
  Log:
  Fix to set output properties correctly in the new output system.
  
  Revision  Changes    Path
  1.8       +1 -10     
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/SAXHTMLOutput.java
  
  Index: SAXHTMLOutput.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/SAXHTMLOutput.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SAXHTMLOutput.java        10 Jun 2002 21:43:04 -0000      1.7
  +++ SAXHTMLOutput.java        19 Jun 2002 19:24:49 -0000      1.8
  @@ -75,8 +75,6 @@
   
   public class SAXHTMLOutput extends SAXOutput { 
   
  -    private String  _mediaType   = "text/html";
  -
       public SAXHTMLOutput(ContentHandler handler, String encoding) 
        throws IOException 
       {
  @@ -202,12 +200,5 @@
           catch (SAXException e) {
               throw new TransletException(e);
           }
  -    }
  -
  -    /**
  -     * Set the output media type - only relevant for HTML output
  -     */
  -    public void setMediaType(String mediaType) {
  -     _mediaType = mediaType;
       }
   }
  
  
  
  1.12      +1 -10     
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/StreamHTMLOutput.java
  
  Index: StreamHTMLOutput.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/StreamHTMLOutput.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- StreamHTMLOutput.java     18 Jun 2002 22:29:27 -0000      1.11
  +++ StreamHTMLOutput.java     19 Jun 2002 19:24:49 -0000      1.12
  @@ -97,16 +97,7 @@
   
       public StreamHTMLOutput(StreamOutput output) {
        super(output);
  -
   // System.out.println("StreamHTMLOutput.<init>");
  -
  -     // Transfer output settings
  -     setDoctype(output._doctypeSystem, output._doctypePublic);
  -     omitHeader(output._omitHeader);
  -     setStandalone(output._standalone);
  -
  -     // Indentation turned on for HTML
  -     setIndent(true);
       }
   
       public StreamHTMLOutput(Writer writer, String encoding) {
  
  
  
  1.15      +5 -1      
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/StreamOutput.java
  
  Index: StreamOutput.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/StreamOutput.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- StreamOutput.java 18 Jun 2002 22:29:27 -0000      1.14
  +++ StreamOutput.java 19 Jun 2002 19:24:49 -0000      1.15
  @@ -181,6 +181,10 @@
        _standalone = standalone;
       }
   
  +    public void setVersion(String version) { 
  +     _version = version;
  +    }
  +
       protected void outputBuffer() {
        try {
            int n = 0;
  
  
  
  1.5       +47 -3     
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/StreamUnknownOutput.java
  
  Index: StreamUnknownOutput.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/StreamUnknownOutput.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StreamUnknownOutput.java  18 Jun 2002 15:12:41 -0000      1.4
  +++ StreamUnknownOutput.java  19 Jun 2002 19:24:49 -0000      1.5
  @@ -78,16 +78,22 @@
   public class StreamUnknownOutput extends StreamOutput {
   
       private StreamOutput _handler;
  -    private boolean      _callStartDocument  = false;
   
       private boolean      _isHtmlOutput = false;
  -    private boolean      _firstTagOpen  = false;
  +    private boolean      _firstTagOpen = false;
       private boolean      _firstElement = true;
       private String       _firstTagPrefix, _firstTag;
   
       private ArrayList    _attributes = null;
       private ArrayList    _namespaces = null;
   
  +    // Cache calls to output properties events
  +    private String       _mediaType          = null;
  +    private boolean      _callStartDocument  = false;
  +    private boolean      _callSetIndent      = false;
  +    private boolean      _callSetVersion     = false;
  +    private boolean      _callSetDoctype     = false;
  +
       static class Pair {
        public String name, value;
   
  @@ -235,10 +241,26 @@
   
       public void setDoctype(String system, String pub) {
        _handler.setDoctype(system, pub);
  +
  +     // Cache call to setDoctype()
  +     super.setDoctype(system, pub);
  +     _callSetDoctype = true;
       }
   
       public void setIndent(boolean indent) { 
        _handler.setIndent(indent);
  +
  +     // Cache call to setIndent()
  +     super.setIndent(indent);
  +     _callSetIndent = true;
  +    }
  +
  +    public void setVersion(String version) { 
  +     _handler.setVersion(version);
  +
  +     // Cache call to setVersion()
  +     super.setVersion(version);
  +     _callSetVersion = true;
       }
   
       public void omitHeader(boolean value) {
  @@ -249,6 +271,11 @@
        _handler.setStandalone(standalone);
       }
   
  +    public void setMediaType(String mediaType) { 
  +     _handler.setMediaType(mediaType);
  +     _mediaType = mediaType;
  +    }
  +
       public boolean setEscaping(boolean escape) 
        throws TransletException 
       { 
  @@ -262,10 +289,27 @@
       private void initStreamOutput() 
        throws TransletException 
       {
  +// System.out.println("initStreamOutput() _isHtmlOutput = " + _isHtmlOutput);
        // Create a new handler if output is HTML
        if (_isHtmlOutput) {
            _handler = new StreamHTMLOutput(_handler);
  +
  +         // Transfer output properties (HTML only)
  +         if (_callSetIndent) {
  +             _handler.setIndent(_indent);
  +         }
  +         if (_callSetVersion) {
  +             _handler.setVersion(_version);
  +         }
  +         if (_callSetDoctype) {
  +             _handler.setDoctype(_doctypeSystem, _doctypePublic);
  +         }
  +         if (_mediaType != null) {
  +             _handler.setMediaType(_mediaType);
  +         }
        }
  +
  +     // Call startDocument() if necessary
        if (_callStartDocument) {
            _handler.startDocument();
            _callStartDocument = false;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to