sboag       99/12/13 11:13:08

  Modified:    src/org/apache/xalan/xpath/xml FormatterToHTML.java
                        FormatterToXML.java
  Log:
  Fix for bug with not outputting the DOCTYPE name.
  
  Revision  Changes    Path
  1.11      +1 -1      
xml-xalan/src/org/apache/xalan/xpath/xml/FormatterToHTML.java
  
  Index: FormatterToHTML.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/xml/FormatterToHTML.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- FormatterToHTML.java      1999/12/13 16:57:04     1.10
  +++ FormatterToHTML.java      1999/12/13 19:13:07     1.11
  @@ -427,7 +427,7 @@
       {
         if((null != m_doctypeSystem) || (null != m_doctypePublic))
         {
  -        accum("<!DOCTYPE HTML ");          
  +        accum("<!DOCTYPE HTML");          
           if(null != m_doctypePublic)
           {
             if(null != m_doctypePublic)
  
  
  
  1.13      +30 -19    
xml-xalan/src/org/apache/xalan/xpath/xml/FormatterToXML.java
  
  Index: FormatterToXML.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/xml/FormatterToXML.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- FormatterToXML.java       1999/12/13 18:14:17     1.12
  +++ FormatterToXML.java       1999/12/13 19:13:07     1.13
  @@ -456,6 +456,30 @@
     {
       // I don't do anything with this yet.
     }
  +  
  +  /**
  +   * Output the doc type declaration.
  +   */
  +  void outputDocTypeDecl(String name)
  +    throws SAXException
  +  {
  +      accum("<!DOCTYPE ");
  +      accum(name);
  +      
  +      if(null != m_doctypePublic)
  +      {
  +        accum(" PUBLIC \"");
  +        accum(m_doctypePublic);
  +        accum("\"");
  +      }
  +      if(null == m_doctypePublic)
  +        accum(" SYSTEM \"");
  +      else
  +        accum(" \"");
  +      accum(m_doctypeSystem);
  +      accum("\">");
  +      outputLineSep();
  +  }
   
     /**
      * Receive notification of the beginning of a document.
  @@ -479,25 +503,6 @@
               encoding + "\"?>");
         outputLineSep();
       }      
  -    if((true == m_needToOutputDocTypeDecl) && (null != m_doctypeSystem))
  -    {
  -      accum("<!DOCTYPE ");
  -      
  -      if(null != m_doctypePublic)
  -      {
  -        accum(" PUBLIC \"");
  -        accum(m_doctypePublic);
  -        accum("\"");
  -      }
  -      if(null == m_doctypePublic)
  -        accum(" SYSTEM \"");
  -      else
  -        accum(" \"");
  -      accum(m_doctypeSystem);
  -      accum("\">");
  -      outputLineSep();
  -    }  
  -    m_needToOutputDocTypeDecl = false;
     }
   
     /**
  @@ -564,6 +569,12 @@
     public void startElement (String name, AttributeList atts)
       throws SAXException
     {
  +    if((true == m_needToOutputDocTypeDecl) && (null != m_doctypeSystem))
  +    {
  +      outputDocTypeDecl(name);
  +    }  
  +    m_needToOutputDocTypeDecl = false;
  +
       writeParentTagEnd();
       m_ispreserve = false;
       //  System.out.println(name+": m_doIndent = "+m_doIndent+", m_ispreserve 
= "+m_ispreserve+", m_isprevtext = "+m_isprevtext);
  
  
  

Reply via email to