You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ar...@locus.apache.org on 2000/08/30 20:59:27 UTC

cvs commit: xml-xerces/java/src/org/apache/xml/serialize BaseMarkupSerializer.java DOMSerializer.java ElementState.java Encodings.java HTMLEntities.res HTMLSerializer.java HTMLdtd.java IndentPrinter.java LineSeparator.java Method.java OutputFormat.java Printer.java Serializer.java SerializerFactory.java SerializerFactoryImpl.java TextSerializer.java XHTMLSerializer.java XMLSerializer.java

arkin       00/08/30 11:59:27

  Modified:    java/src/org/apache/xml/serialize BaseMarkupSerializer.java
                        DOMSerializer.java ElementState.java Encodings.java
                        HTMLEntities.res HTMLSerializer.java HTMLdtd.java
                        IndentPrinter.java LineSeparator.java Method.java
                        OutputFormat.java Printer.java Serializer.java
                        SerializerFactory.java SerializerFactoryImpl.java
                        TextSerializer.java XHTMLSerializer.java
                        XMLSerializer.java
  Log:
  BaseMarkupSerializer.java
  
  Revision  Changes    Path
  1.18      +46 -37    xml-xerces/java/src/org/apache/xml/serialize/BaseMarkupSerializer.java
  
  Index: BaseMarkupSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/BaseMarkupSerializer.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- BaseMarkupSerializer.java	2000/08/15 19:25:56	1.17
  +++ BaseMarkupSerializer.java	2000/08/30 18:59:19	1.18
  @@ -56,6 +56,22 @@
    */
   
   
  +// Aug 25, 2000:
  +//   Fixed processing instruction printing inside element content
  +//   to not escape content. Reported by Mikael Staldal
  +//   <d9...@d.kth.se>
  +// Aug 25, 2000:
  +//   Added ability to omit comments.
  +//   Contributed by Anupam Bagchi <ab...@jtcsv.com>
  +// Aug 26, 2000:
  +//   Fixed bug in newline handling when preserving spaces.
  +//   Contributed by Mike Dusseault <md...@home.com>
  +// Aug 29, 2000:
  +//   Fixed state.unescaped not being set to false when
  +//   entering element state.
  +//   Reported by Lowell Vaughn <lv...@agillion.com>
  +
  +
   package org.apache.xml.serialize;
   
   
  @@ -118,8 +134,8 @@
    * another element.
    *
    *
  - * @version $Revision: 1.17 $ $Date: 2000/08/15 19:25:56 $
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  + * @version $Revision: 1.18 $ $Date: 2000/08/30 18:59:19 $
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    * @see Serializer
    * @see DOMSerializer
    */
  @@ -316,14 +332,14 @@
       }
   
   
  -    private void prepare()
  +    protected void prepare()
           throws IOException
       {
           if ( _prepared )
               return;
   
           if ( _writer == null && _output == null )
  -            throw new IllegalStateException( "SER002 No writer supplied for serializer" );
  +            throw new IOException( "SER002 No writer supplied for serializer" );
           // If the output stream has been set, use it to construct
           // the writer. It is possible that the serializer has been
           // reused with the same output stream and different encoding.
  @@ -386,11 +402,6 @@
           throws IOException
       {
           prepare();
  -        if ( _printer == null )
  -            throw new IllegalStateException( "SER002 No writer supplied for serializer" );
  -        try {
  -            startDocument();
  -        } catch ( SAXException except ) { }
           serializeNode( elem );
           _printer.flush();
           if ( _printer.getException() != null )
  @@ -411,11 +422,6 @@
           throws IOException
       {
           prepare();
  -        if ( _printer == null )
  -            throw new IllegalStateException( "SER002 No writer supplied for serializer" );
  -        try {
  -            startDocument();
  -        } catch ( SAXException except ) { }
           serializeNode( frag );
           _printer.flush();
           if ( _printer.getException() != null )
  @@ -436,11 +442,6 @@
           throws IOException
       {
           prepare();
  -        if ( _printer == null )
  -            throw new IllegalStateException( "SER002 No writer supplied for serializer" );
  -        try {
  -            startDocument();
  -        } catch ( SAXException except ) { }
           serializeNode( doc );
           serializePreRoot();
           _printer.flush();
  @@ -454,6 +455,18 @@
       //------------------------------------------//
   
   
  +    public void startDocument()
  +        throws SAXException
  +    {
  +        try {
  +            prepare();
  +        } catch ( IOException except ) {
  +            throw new SAXException( except.toString() );
  +        }
  +        // Nothing to do here. All the magic happens in startDocument(String)
  +    }
  +    
  +    
       public void characters( char[] chars, int start, int length )
       {
           ElementState state;
  @@ -521,12 +534,8 @@
           // not indent twice.
           if ( _indenting ) {
               _printer.setThisIndent( 0 );
  -            for ( i = start ; length-- > 0 ; ++i ) {
  -                if ( chars[ i ] == '\n' || chars[ i ] == '\r' )
  -                    _printer.breakLine( true );
  -                else
  -                    _printer.printText( chars[ i ] );
  -            }
  +            for ( i = start ; length-- > 0 ; ++i )
  +                _printer.printText( chars[ i ] );
           }
       }
   
  @@ -565,7 +574,7 @@
               _preRoot.addElement( buffer.toString() );
           } else {
               _printer.indent();
  -            printText( buffer.toString(), true, false );
  +            printText( buffer.toString(), true, true );
               _printer.unindent();
           }
       }
  @@ -582,8 +591,9 @@
           StringBuffer buffer;
           int          index;
           ElementState state;
  -
  -        if (_format.getStripComments()) return;
  +        
  +        if ( _format.getOmitComments() )
  +            return;
   
           state  = content();
           buffer = new StringBuffer( 40 );
  @@ -906,9 +916,11 @@
           case Node.COMMENT_NODE : {
               String text;
   
  -            text = node.getNodeValue();
  -            if ( text != null )
  -                comment( node.getNodeValue() );
  +            if ( ! _format.getOmitComments() ) {
  +                text = node.getNodeValue();
  +                if ( text != null )
  +                    comment( node.getNodeValue() );
  +            }
               break;
           }
   
  @@ -1179,9 +1191,7 @@
               while ( length-- > 0 ) {
                   ch = chars[ start ];
                   ++start;
  -                if ( ch == '\n' || ch == '\r' )
  -                    _printer.breakLine( true );
  -                else if ( unescaped )
  +                if ( ch == '\n' || ch == '\r' || ! unescaped )
                       _printer.printText( ch );
                   else
                       printEscaped( ch );
  @@ -1218,9 +1228,7 @@
               // break will occur.
               for ( index = 0 ; index < text.length() ; ++index ) {
                   ch = text.charAt( index );
  -                if ( ch == '\n' || ch == '\r' )
  -                    _printer.breakLine( true );
  -                else if ( unescaped )
  +                if ( ch == '\n' || ch == '\r' || ! unescaped ) 
                       _printer.printText( ch );
                   else
                       printEscaped( ch );
  @@ -1359,6 +1367,7 @@
           state.empty = true;
           state.afterElement = false;
           state.doCData = state.inCData = false;
  +        state.unescaped = false;
           state.prefixes = _prefixes;
   
           _prefixes = null;
  
  
  
  1.3       +2 -2      xml-xerces/java/src/org/apache/xml/serialize/DOMSerializer.java
  
  Index: DOMSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/DOMSerializer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DOMSerializer.java	2000/03/28 23:09:08	1.2
  +++ DOMSerializer.java	2000/08/30 18:59:19	1.3
  @@ -70,9 +70,9 @@
    * Interface for a DOM serializer implementation.
    * 
    *
  - * @version $Revision: 1.2 $ $Date: 2000/03/28 23:09:08 $
  + * @version $Revision: 1.3 $ $Date: 2000/08/30 18:59:19 $
    * @author <a href="mailto:Scott_Boag/CAM/Lotus@lotus.com">Scott Boag</a>
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    */
   public interface DOMSerializer
   {
  
  
  
  1.6       +2 -2      xml-xerces/java/src/org/apache/xml/serialize/ElementState.java
  
  Index: ElementState.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/ElementState.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ElementState.java	2000/03/28 23:09:08	1.5
  +++ ElementState.java	2000/08/30 18:59:20	1.6
  @@ -66,8 +66,8 @@
    * Holds the state of the currently serialized element.
    *
    *
  - * @version $Revision: 1.5 $ $Date: 2000/03/28 23:09:08 $
  - * @author <a href="mailto:arkin@openxml.org">Assaf Arkin</a>
  + * @version $Revision: 1.6 $ $Date: 2000/08/30 18:59:20 $
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    * @see BaseMarkupSerializer
    */
   class ElementState
  
  
  
  1.2       +2 -2      xml-xerces/java/src/org/apache/xml/serialize/Encodings.java
  
  Index: Encodings.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/Encodings.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Encodings.java	2000/03/28 23:04:07	1.1
  +++ Encodings.java	2000/08/30 18:59:20	1.2
  @@ -71,8 +71,8 @@
    * to override encoding names and provide the last printable character
    * for each encoding.
    *
  - * @version $Revision: 1.1 $ $Date: 2000/03/28 23:04:07 $
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  + * @version $Revision: 1.2 $ $Date: 2000/08/30 18:59:20 $
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    */
   class Encodings
   {
  
  
  
  1.3       +3 -3      xml-xerces/java/src/org/apache/xml/serialize/HTMLEntities.res
  
  Index: HTMLEntities.res
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/HTMLEntities.res,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HTMLEntities.res	2000/07/13 01:12:06	1.2
  +++ HTMLEntities.res	2000/08/30 18:59:20	1.3
  @@ -1,7 +1,7 @@
  -# $Id: HTMLEntities.res,v 1.2 2000/07/13 01:12:06 arkin Exp $
  +# $Id: HTMLEntities.res,v 1.3 2000/08/30 18:59:20 arkin Exp $
   #
  -# @version $Revision: 1.2 $ $Date: 2000/07/13 01:12:06 $
  -# @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  +# @version $Revision: 1.3 $ $Date: 2000/08/30 18:59:20 $
  +# @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
   #
   # Character entity references for markup-significant
   #
  
  
  
  1.13      +33 -33    xml-xerces/java/src/org/apache/xml/serialize/HTMLSerializer.java
  
  Index: HTMLSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/HTMLSerializer.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- HTMLSerializer.java	2000/05/10 00:15:43	1.12
  +++ HTMLSerializer.java	2000/08/30 18:59:21	1.13
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    notice, this list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xerces" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -56,6 +56,13 @@
    */
   
   
  +// Aug 21, 2000:
  +//  Fixed bug in startDocument not calling prepare.
  +//  Reported by Mikael Staldal <d9...@d.kth.se>
  +// Aug 21, 2000:
  +//  Added ability to omit DOCTYPE declaration.
  +
  +
   package org.apache.xml.serialize;
   
   
  @@ -109,8 +116,8 @@
    * </ul>
    *
    *
  - * @version $Revision: 1.12 $ $Date: 2000/05/10 00:15:43 $
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  + * @version $Revision: 1.13 $ $Date: 2000/08/30 18:59:21 $
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    * @see Serializer
    */
   public class HTMLSerializer
  @@ -450,15 +457,6 @@
       }
       
       
  -    public void startDocument()
  -    {
  -        // Do nothing for HTML/XHTML, browser might not respond
  -        // well to <?xml ...?>
  -        if ( _printer == null )
  -            throw new IllegalStateException( "SER002 No writer supplied for serializer" );
  -    }
  -    
  -    
       public void startElement( String tagName, AttributeList attrs )
       {
           int          i;
  @@ -618,28 +616,30 @@
                   }
               }
   
  -            // XHTML: If public idnentifier and system identifier
  -            //  specified, print them, else print just system identifier
  -            // HTML: If public identifier specified, print it with
  -            //  system identifier, if specified.
  -            if ( _docTypePublicId != null && ( ! _xhtml || _docTypeSystemId != null )  ) {
  -                _printer.printText( "<!DOCTYPE HTML PUBLIC " );
  -                printDoctypeURL( _docTypePublicId );
  -                if ( _docTypeSystemId != null ) {
  -                    if ( _indenting ) {
  -                        _printer.breakLine();
  -                        _printer.printText( "                      " );
  -                    } else
  +            if ( ! _format.getOmitDocumentType() ) {
  +                // XHTML: If public idnentifier and system identifier
  +                //  specified, print them, else print just system identifier
  +                // HTML: If public identifier specified, print it with
  +                //  system identifier, if specified.
  +                if ( _docTypePublicId != null && ( ! _xhtml || _docTypeSystemId != null )  ) {
  +                    _printer.printText( "<!DOCTYPE HTML PUBLIC " );
  +                    printDoctypeURL( _docTypePublicId );
  +                    if ( _docTypeSystemId != null ) {
  +                        if ( _indenting ) {
  +                            _printer.breakLine();
  +                            _printer.printText( "                      " );
  +                        } else
                           _printer.printText( ' ' );
  +                        printDoctypeURL( _docTypeSystemId );
  +                    }
  +                    _printer.printText( '>' );
  +                    _printer.breakLine();
  +                } else if ( _docTypeSystemId != null ) {
  +                    _printer.printText( "<!DOCTYPE HTML SYSTEM " );
                       printDoctypeURL( _docTypeSystemId );
  +                    _printer.printText( '>' );
  +                    _printer.breakLine();
                   }
  -                _printer.printText( '>' );
  -                _printer.breakLine();
  -            } else if ( _docTypeSystemId != null ) {
  -                _printer.printText( "<!DOCTYPE HTML SYSTEM " );
  -                printDoctypeURL( _docTypeSystemId );
  -                _printer.printText( '>' );
  -                _printer.breakLine();
               }
           }
           
  
  
  
  1.9       +9 -4      xml-xerces/java/src/org/apache/xml/serialize/HTMLdtd.java
  
  Index: HTMLdtd.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/HTMLdtd.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- HTMLdtd.java	2000/03/28 23:09:08	1.8
  +++ HTMLdtd.java	2000/08/30 18:59:21	1.9
  @@ -56,6 +56,11 @@
    */
   
   
  +// Aug 21, 2000:
  +//   Fixed bug in isElement and made HTMLdtd public.
  +//   Contributed by Eric SCHAEFFER" <es...@posterconseil.com>
  +
  +
   package org.apache.xml.serialize;
   
   
  @@ -76,10 +81,10 @@
    * first time any of these methods is called for fast and efficient access.
    *
    *
  - * @version $Revision: 1.8 $ $Date: 2000/03/28 23:09:08 $
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  + * @version $Revision: 1.9 $ $Date: 2000/08/30 18:59:21 $
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    */
  -final class HTMLdtd
  +public final class HTMLdtd
   {
   
   
  @@ -469,7 +474,7 @@
           if ( flags == null )
               return false;
           else
  -            return ( ( flags.intValue() & flag ) != 0 );
  +            return ( ( flags.intValue() & flag ) == flag );
       }
       
       
  
  
  
  1.3       +2 -2      xml-xerces/java/src/org/apache/xml/serialize/IndentPrinter.java
  
  Index: IndentPrinter.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/IndentPrinter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IndentPrinter.java	2000/07/13 01:16:23	1.2
  +++ IndentPrinter.java	2000/08/30 18:59:21	1.3
  @@ -68,8 +68,8 @@
    * Extends {@link Printer} and adds support for indentation and line
    * wrapping.
    *
  - * @version $Revision: 1.2 $ $Date: 2000/07/13 01:16:23 $
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  + * @version $Revision: 1.3 $ $Date: 2000/08/30 18:59:21 $
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    */
   class IndentPrinter
       extends Printer
  
  
  
  1.3       +2 -2      xml-xerces/java/src/org/apache/xml/serialize/LineSeparator.java
  
  Index: LineSeparator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/LineSeparator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LineSeparator.java	2000/03/28 23:09:08	1.2
  +++ LineSeparator.java	2000/08/30 18:59:21	1.3
  @@ -60,8 +60,8 @@
   
   
   /**
  - * @version $Revision: 1.2 $ $Date: 2000/03/28 23:09:08 $
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  + * @version $Revision: 1.3 $ $Date: 2000/08/30 18:59:21 $
  + * @author <a href="mailto:arkin@intalio..com">Assaf Arkin</a>
    * @see OutputFormat
    */
   public final class LineSeparator
  
  
  
  1.3       +2 -2      xml-xerces/java/src/org/apache/xml/serialize/Method.java
  
  Index: Method.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/Method.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Method.java	2000/03/28 23:09:08	1.2
  +++ Method.java	2000/08/30 18:59:21	1.3
  @@ -60,8 +60,8 @@
   
   
   /**
  - * @version $Revision: 1.2 $ $Date: 2000/03/28 23:09:08 $
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  + * @version $Revision: 1.3 $ $Date: 2000/08/30 18:59:21 $
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    * @see OutputFormat
    */
   public final class Method
  
  
  
  1.9       +65 -20    xml-xerces/java/src/org/apache/xml/serialize/OutputFormat.java
  
  Index: OutputFormat.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/OutputFormat.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- OutputFormat.java	2000/08/15 19:25:56	1.8
  +++ OutputFormat.java	2000/08/30 18:59:21	1.9
  @@ -56,6 +56,14 @@
    */
   
   
  +// Aug 21, 2000:
  +//  Added ability to omit DOCTYPE declaration.
  +//  Reported by Lars Martin <la...@smb-tec.com>
  +// Aug 25, 2000:
  +//  Added ability to omit comments.
  +//  Contributed by Anupam Bagchi <ab...@jtcsv.com>
  +
  +
   package org.apache.xml.serialize;
   
   
  @@ -83,9 +91,9 @@
    * </ul>
    *
    *
  - * @version $Revision: 1.8 $ $Date: 2000/08/15 19:25:56 $
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  - *         <a href="mailto:visco@exoffice.com">Keith Visco</a>
  + * @version $Revision: 1.9 $ $Date: 2000/08/30 18:59:21 $
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
  + *         <a href="mailto:visco@intalio.com">Keith Visco</a>
    * @see Serializer
    * @see Method
    * @see LineSeparator
  @@ -202,6 +210,19 @@
   
   
       /**
  +     * Ture if the DOCTYPE declaration should be ommited;
  +     */
  +    private boolean _omitDoctype = false;
  +
  +
  +    /**
  +<<<<<<< OutputFormat.java
  +     * Ture if comments should be ommited;
  +     */
  +    private boolean _omitComments = false;
  +
  +
  +    /**
        * Ture if the comments should be ommited;
        */
       private boolean _stripComments = false;
  @@ -486,9 +507,11 @@
   
       /**
        * Sets the document type public and system identifiers.
  -     * No <tt>DOCTYPE</tt> will be serialized if both identifiers
  -     * are null. A system identifier is required if a public
  -     * identified is specified.
  +     * Required only if the DOM Document or SAX events do not
  +     * specify the document type, and one must be present in
  +     * the serialized document. Any document type specified
  +     * by the DOM Document or SAX events will override these
  +     * values.
        *
        * @param publicId The public identifier, or null
        * @param systemId The system identifier, or null
  @@ -521,43 +544,65 @@
   
   
       /**
  -     * Returns true if the XML document declaration should
  +     * Returns true if comments should be ommited.
  +     * The default is false.
  +     */
  +    public boolean getOmitComments()
  +    {
  +        return _omitComments;
  +    }
  +
  +
  +    /**
  +     * Sets comment omitting on and off.
  +     *
  +     * @param omit True if comments should be ommited
  +     */
  +    public void setOmitComments( boolean omit )
  +    {
  +        _omitComments = omit;
  +    }
  +
  +
  +    /**
  +     * Returns true if the DOCTYPE declaration should
        * be ommited. The default is false.
        */
  -    public boolean getOmitXMLDeclaration()
  +    public boolean getOmitDocumentType()
       {
  -        return _omitXmlDeclaration;
  +        return _omitDoctype;
       }
   
   
       /**
  -     * Sets XML declaration omitting on and off.
  +     * Sets DOCTYPE declaration omitting on and off.
        *
  -     * @param omit True if XML declaration should be ommited
  +     * @param omit True if DOCTYPE declaration should be ommited
        */
  -    public void setOmitXMLDeclaration( boolean omit )
  +    public void setOmitDocumentType( boolean omit )
       {
  -        _omitXmlDeclaration = omit;
  +        _omitDoctype = omit;
       }
   
  +
       /**
  -     * Returns true if comments should
  +     * Returns true if the XML document declaration should
        * be ommited. The default is false.
        */
  -    public boolean getStripComments()
  +    public boolean getOmitXMLDeclaration()
       {
  -        return _stripComments;
  +        return _omitXmlDeclaration;
       }
   
   
       /**
  -     * Sets stripping comments on and off.
  +     * Sets XML declaration omitting on and off.
        *
  -     * @param strip True if comments should be ommited
  +     * @param omit True if XML declaration should be ommited
        */
  -    public void setStripComments( boolean strip )
  +    public void setOmitXMLDeclaration( boolean omit )
       {
  -        _stripComments = strip;
  +        _omitXmlDeclaration = omit;
       }
   
   
  
  
  
  1.3       +2 -2      xml-xerces/java/src/org/apache/xml/serialize/Printer.java
  
  Index: Printer.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/Printer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Printer.java	2000/07/13 01:16:35	1.2
  +++ Printer.java	2000/08/30 18:59:21	1.3
  @@ -70,8 +70,8 @@
    * {@link IndentPrinter} supports indentation and line wrapping by
    * extending this class.
    *
  - * @version $Revision: 1.2 $ $Date: 2000/07/13 01:16:35 $
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  + * @version $Revision: 1.3 $ $Date: 2000/08/30 18:59:21 $
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    */
   public class Printer
   {
  
  
  
  1.9       +2 -2      xml-xerces/java/src/org/apache/xml/serialize/Serializer.java
  
  Index: Serializer.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/Serializer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Serializer.java	2000/03/28 23:09:09	1.8
  +++ Serializer.java	2000/08/30 18:59:21	1.9
  @@ -98,8 +98,8 @@
    * UTF-8 encoding and now indentation.
    * 
    *
  - * @version $Revision: 1.8 $ $Date: 2000/03/28 23:09:09 $
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  + * @version $Revision: 1.9 $ $Date: 2000/08/30 18:59:21 $
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    * @author <a href="mailto:Scott_Boag/CAM/Lotus@lotus.com">Scott Boag</a>
    * @see DocumentHandler
    * @see ContentHandler
  
  
  
  1.4       +2 -2      xml-xerces/java/src/org/apache/xml/serialize/SerializerFactory.java
  
  Index: SerializerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/SerializerFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SerializerFactory.java	2000/03/28 23:09:09	1.3
  +++ SerializerFactory.java	2000/08/30 18:59:22	1.4
  @@ -69,9 +69,9 @@
   /**
    *
    *
  - * @version $Revision: 1.3 $ $Date: 2000/03/28 23:09:09 $
  + * @version $Revision: 1.4 $ $Date: 2000/08/30 18:59:22 $
    * @author <a href="mailto:Scott_Boag/CAM/Lotus@lotus.com">Scott Boag</a>
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    */
   public abstract class SerializerFactory
   {
  
  
  
  1.5       +2 -2      xml-xerces/java/src/org/apache/xml/serialize/SerializerFactoryImpl.java
  
  Index: SerializerFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/SerializerFactoryImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SerializerFactoryImpl.java	2000/03/28 23:09:09	1.4
  +++ SerializerFactoryImpl.java	2000/08/30 18:59:22	1.5
  @@ -69,9 +69,9 @@
    * markup serializers (XML, HTML, XHTML ).
    *
    *
  - * @version $Revision: 1.4 $ $Date: 2000/03/28 23:09:09 $
  + * @version $Revision: 1.5 $ $Date: 2000/08/30 18:59:22 $
    * @author <a href="mailto:Scott_Boag/CAM/Lotus@lotus.com">Scott Boag</a>
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    */
   final class SerializerFactoryImpl
       extends SerializerFactory
  
  
  
  1.7       +2 -8      xml-xerces/java/src/org/apache/xml/serialize/TextSerializer.java
  
  Index: TextSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/TextSerializer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TextSerializer.java	2000/03/28 23:09:09	1.6
  +++ TextSerializer.java	2000/08/30 18:59:22	1.7
  @@ -90,8 +90,8 @@
    * org.xml.sax.DocumentHandler#endDocument}.
    *
    *
  - * @version $Revision: 1.6 $ $Date: 2000/03/28 23:09:09 $
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  + * @version $Revision: 1.7 $ $Date: 2000/08/30 18:59:22 $
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    * @see Serializer
    */
   public final class TextSerializer
  @@ -139,12 +139,6 @@
       // SAX document handler serializing methods //
       //------------------------------000---------//
   
  -    
  -    public void startDocument()
  -    {
  -        // Nothing to do here. All the magic happens in startDocument(String)
  -    }
  -    
       
       public void startElement( String tagName, AttributeList attrs )
       {
  
  
  
  1.6       +2 -2      xml-xerces/java/src/org/apache/xml/serialize/XHTMLSerializer.java
  
  Index: XHTMLSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/XHTMLSerializer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XHTMLSerializer.java	2000/03/28 23:09:09	1.5
  +++ XHTMLSerializer.java	2000/08/30 18:59:22	1.6
  @@ -70,8 +70,8 @@
    * Serializer} or {@link BaseMarkupSerializer}.
    *
    *
  - * @version $Revision: 1.5 $ $Date: 2000/03/28 23:09:09 $
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  + * @version $Revision: 1.6 $ $Date: 2000/08/30 18:59:22 $
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    * @see Serializer
    */
   public final class XHTMLSerializer
  
  
  
  1.16      +45 -44    xml-xerces/java/src/org/apache/xml/serialize/XMLSerializer.java
  
  Index: XMLSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/XMLSerializer.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- XMLSerializer.java	2000/07/13 01:13:12	1.15
  +++ XMLSerializer.java	2000/08/30 18:59:22	1.16
  @@ -56,6 +56,13 @@
    */
   
   
  +// Aug 21, 2000:
  +//  Fixed bug in startDocument not calling prepare.
  +//  Reported by Mikael Staldal <d9...@d.kth.se>
  +// Aug 21, 2000:
  +//  Added ability to omit DOCTYPE declaration.
  +
  +
   package org.apache.xml.serialize;
   
   
  @@ -97,8 +104,8 @@
    * spaces at beginning of line will be stripped.
    *
    *
  - * @version $Revision: 1.15 $ $Date: 2000/07/13 01:13:12 $
  - * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
  + * @version $Revision: 1.16 $ $Date: 2000/08/30 18:59:22 $
  + * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    * @see Serializer
    */
   public final class XMLSerializer
  @@ -346,14 +353,6 @@
       //------------------------------------------//
   
   
  -    public void startDocument()
  -    {
  -        if ( _printer == null )
  -            throw new IllegalStateException( "SER002 No writer supplied for serializer" );
  -        // Nothing to do here. All the magic happens in startDocument(String)
  -    }
  -
  -
       public void startElement( String tagName, AttributeList attrs )
       {
           int          i;
  @@ -492,45 +491,47 @@
                   _printer.breakLine();
               }
   
  -            if ( _docTypeSystemId != null ) {
  -                // System identifier must be specified to print DOCTYPE.
  -                // If public identifier is specified print 'PUBLIC
  -                // <public> <system>', if not, print 'SYSTEM <system>'.
  -                _printer.printText( "<!DOCTYPE " );
  -                _printer.printText( rootTagName );
  -                if ( _docTypePublicId != null ) {
  -                    _printer.printText( " PUBLIC " );
  -                    printDoctypeURL( _docTypePublicId );
  -                    if ( _indenting ) {
  -                        _printer.breakLine();
  -                        for ( i = 0 ; i < 18 + rootTagName.length() ; ++i )
  +            if ( ! _format.getOmitDocumentType() ) {
  +                if ( _docTypeSystemId != null ) {
  +                    // System identifier must be specified to print DOCTYPE.
  +                    // If public identifier is specified print 'PUBLIC
  +                    // <public> <system>', if not, print 'SYSTEM <system>'.
  +                    _printer.printText( "<!DOCTYPE " );
  +                    _printer.printText( rootTagName );
  +                    if ( _docTypePublicId != null ) {
  +                        _printer.printText( " PUBLIC " );
  +                        printDoctypeURL( _docTypePublicId );
  +                        if ( _indenting ) {
  +                            _printer.breakLine();
  +                            for ( i = 0 ; i < 18 + rootTagName.length() ; ++i )
  +                                _printer.printText( " " );
  +                        } else
                               _printer.printText( " " );
  -                    } else
  -                        _printer.printText( " " );
  -                    printDoctypeURL( _docTypeSystemId );
  -                }
  -                else {
  -                    _printer.printText( " SYSTEM " );
                       printDoctypeURL( _docTypeSystemId );
  -                }
  -
  -                // If we accumulated any DTD contents while printing.
  -                // this would be the place to print it.
  -                if ( dtd != null && dtd.length() > 0 ) {
  +                    }
  +                    else {
  +                        _printer.printText( " SYSTEM " );
  +                        printDoctypeURL( _docTypeSystemId );
  +                    }
  +                    
  +                    // If we accumulated any DTD contents while printing.
  +                    // this would be the place to print it.
  +                    if ( dtd != null && dtd.length() > 0 ) {
  +                        _printer.printText( " [" );
  +                        printText( dtd, true, true );
  +                        _printer.printText( ']' );
  +                    }
  +                    
  +                    _printer.printText( ">" );
  +                    _printer.breakLine();
  +                } else if ( dtd != null && dtd.length() > 0 ) {
  +                    _printer.printText( "<!DOCTYPE " );
  +                    _printer.printText( rootTagName );
                       _printer.printText( " [" );
                       printText( dtd, true, true );
  -                    _printer.printText( ']' );
  +                    _printer.printText( "]>" );
  +                    _printer.breakLine();
                   }
  -
  -                _printer.printText( ">" );
  -                _printer.breakLine();
  -            } else if ( dtd != null && dtd.length() > 0 ) {
  -                _printer.printText( "<!DOCTYPE " );
  -                _printer.printText( rootTagName );
  -                _printer.printText( " [" );
  -                printText( dtd, true, true );
  -                _printer.printText( "]>" );
  -                _printer.breakLine();
               }
           }
           _started = true;