snagy       01/01/31 12:03:17

  Modified:    example  TestBed.java
               src/java/org/apache/ecs Document.java FrameSetDocument.java
  Log:
  There are some errors in the code of this class. They are the same kind of errors 
that I found in
  org.apache.ecs.Document. The problem is mainly in the setXXX methods (setBody for 
example), which forgets to
  update the local reference AND the reference in the Hashtable.
  
  Submitted by: Joan Roach [EMAIL PROTECTED]
  
  Revision  Changes    Path
  1.13      +6 -6      jakarta-ecs/example/TestBed.java
  
  Index: TestBed.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ecs/example/TestBed.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TestBed.java      2000/03/23 18:21:07     1.12
  +++ TestBed.java      2001/01/31 20:03:16     1.13
  @@ -68,7 +68,7 @@
   /**
       This class is used for development/regression testing
   
  -    @version $Id: TestBed.java,v 1.12 2000/03/23 18:21:07 stephan Exp $
  +    @version $Id: TestBed.java,v 1.13 2001/01/31 20:03:16 snagy Exp $
       @author <a href="mailto:[EMAIL PROTECTED]">Stephan Nagy</a>
       @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
   */
  @@ -1000,11 +1000,11 @@
           org.apache.ecs.factory.DOMFactory d = new 
org.apache.ecs.factory.DOMFactory();
           p.output(d.getOutputStream());
   
  -        NodeList nl = d.createDOM();
  -        for(int a = 0; a < nl.getLength(); a++)
  -        {
  -           traverse(nl.item(a));
  -        }
  +        //NodeList nl = d.createDOM();
  +        //for(int a = 0; a < nl.getLength(); a++)
  +        //{
  +        //   traverse(nl.item(a));
  +        //}
       }
   
       private static void traverse(Node node)
  
  
  
  1.8       +4 -1      jakarta-ecs/src/java/org/apache/ecs/Document.java
  
  Index: Document.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ecs/src/java/org/apache/ecs/Document.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Document.java     2000/04/10 16:59:19     1.7
  +++ Document.java     2001/01/31 20:03:17     1.8
  @@ -64,7 +64,7 @@
   /**
       This class creates a Document container, for convience.
   
  -    @version $Id: Document.java,v 1.7 2000/04/10 16:59:19 jonbolt Exp $
  +    @version $Id: Document.java,v 1.8 2001/01/31 20:03:17 snagy Exp $
       @author <a href="mailto:[EMAIL PROTECTED]">Stephan Nagy</a>
       @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
   */
  @@ -157,6 +157,7 @@
       public Document setHead(Head set_head)
       {
           html.addElement("head",set_head);
  +        this.head = set_head;
           return(this);
       }
       
  @@ -194,6 +195,7 @@
       public Document setBody(Body set_body)
       {
           html.addElement("body",set_body);
  +        this.body = set_body;
           return(this);
       }
       
  @@ -231,6 +233,7 @@
       public Document setTitle(Title set_title)
       {
           head.addElement("title",set_title);
  +        this.title = set_title;
           return(this);
       }
       
  
  
  
  1.2       +70 -11    jakarta-ecs/src/java/org/apache/ecs/FrameSetDocument.java
  
  Index: FrameSetDocument.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ecs/src/java/org/apache/ecs/FrameSetDocument.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FrameSetDocument.java     1999/07/05 18:38:44     1.1
  +++ FrameSetDocument.java     2001/01/31 20:03:17     1.2
  @@ -65,7 +65,7 @@
   /**
       This class creates a FrameSetDocument container, for convience.
   
  -    @version $Id: FrameSetDocument.java,v 1.1 1999/07/05 18:38:44 stephan Exp $
  +    @version $Id: FrameSetDocument.java,v 1.2 2001/01/31 20:03:17 snagy Exp $
       @author <a href="mailto:[EMAIL PROTECTED]">Stephan Nagy</a>
       @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
   */
  @@ -83,6 +83,8 @@
       private FrameSet frameset;
       /** @serial noframes frameset */
       private NoFrames noframes;
  +    /** @serial doctype doctype */
  +    private Doctype doctype = null;
   
       /** @serial codeset codeset */
       private String codeset = null;
  @@ -95,11 +97,11 @@
           noframes = new NoFrames();
           body = new Body();
           
  -        head.addElement(title);
  -        html.addElement(head);
  -        html.addElement(frameset);
  -        html.addElement(noframes);
  -        noframes.addElement(body);        
  +        head.addElement("title",title);
  +        html.addElement("head",head);
  +        html.addElement("frameset",frameset);
  +        html.addElement("noframes",noframes);
  +        noframes.addElement("body",body);        
       }
       
       /**
  @@ -118,6 +120,23 @@
       }
   
       /**
  +        Get the doctype element for this document container.
  +    */
  +    public Doctype getDoctype()
  +    {
  +        return(doctype);
  +    }
  +    
  +    /**
  +        Set the doctype element for this document container.
  +    */
  +    public FrameSetDocument setDoctype(Doctype set_doctype)
  +    {
  +        this.doctype = set_doctype;
  +        return(this);
  +    }
  +
  +    /**
           Get the html element for this document container.
       */
       public Html getHtml()
  @@ -147,6 +166,7 @@
       */
       public FrameSetDocument setHead(Head set_head)
       {
  +        html.addElement("head",set_head);
           this.head = set_head;
           return(this);
       }
  @@ -182,8 +202,9 @@
       /**
           Set the FrameSet element for this FrameSetDocument container.
       */
  -    public FrameSetDocument setHead(FrameSet set_frameset)
  +    public FrameSetDocument setFrameSet(FrameSet set_frameset)
       {
  +        html.addElement("frameset",set_frameset);
           this.frameset = set_frameset;
           return(this);
       }
  @@ -219,7 +240,8 @@
           Set the Body element for this FrameSetDocument container.
       */
       public FrameSetDocument setBody(Body set_body)
  -    {
  +    {       
  +        noframes.addElement("body",set_body);
           this.body = set_body;
           return(this);
       }
  @@ -257,6 +279,7 @@
       */
       public FrameSetDocument setTitle(Title set_title)
       {
  +        head.addElement("title",set_title);
           this.title = set_title;
           return(this);
       }
  @@ -304,6 +327,16 @@
       */
       public void output(OutputStream out)
       {
  +        if (doctype != null)
  +        {
  +            doctype.output(out);
  +            try
  +            {
  +                out.write('\n');
  +            }
  +            catch ( Exception e)
  +            {}
  +        }
           // FrameSetDocument is just a convient wrapper for Html call Html.output
           html.output(out);
       }
  @@ -313,6 +346,16 @@
       */
       public void output(PrintWriter out)
       {
  +        if (doctype != null)
  +        {
  +            doctype.output(out);
  +            try
  +            {
  +                out.write('\n');
  +            }
  +            catch ( Exception e)
  +            {}
  +        }
           // FrameSetDocument is just a convient wrapper for Html call Html.output
           html.output(out);
       }
  @@ -322,10 +365,21 @@
       */
       public final String toString()
       {
  +        StringBuffer sb = new StringBuffer();
           if ( getCodeset() != null )
  -            return (html.toString(getCodeset()));
  +        {
  +            if (doctype != null)
  +                sb.append (doctype.toString(getCodeset()));
  +            sb.append (html.toString(getCodeset()));
  +            return (sb.toString());
  +        }
           else
  -            return(html.toString());
  +        {
  +            if (doctype != null)
  +                sb.append (doctype.toString());
  +            sb.append (html.toString());
  +            return(sb.toString());
  +        }
       }
   
       /**
  @@ -333,8 +387,13 @@
       */
       public final String toString(String codeset)
       {
  -        return(html.toString(codeset));
  +        StringBuffer sb = new StringBuffer();
  +        if (doctype != null)
  +            sb.append (doctype.toString(getCodeset()));
  +        sb.append (html.toString(getCodeset()));
  +        return(sb.toString());
       }
  +   
       /**
           Allows the FrameSetDocument to be cloned.  Doesn't return an instanceof 
FrameSetDocument returns instance of Html.
   
  
  
  

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

Reply via email to