You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ecs-dev@jakarta.apache.org by rd...@apache.org on 2002/01/28 23:50:33 UTC

cvs commit: jakarta-ecs/src/java/org/apache/ecs/xml XMLDocument.java

rdonkin     02/01/28 14:50:33

  Modified:    src/java/org/apache/ecs/xml XMLDocument.java
  Log:
  Fixed xml document pretty print bug
  
  Revision  Changes    Path
  1.7       +15 -0     jakarta-ecs/src/java/org/apache/ecs/xml/XMLDocument.java
  
  Index: XMLDocument.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ecs/src/java/org/apache/ecs/xml/XMLDocument.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XMLDocument.java	29 Mar 2001 22:59:59 -0000	1.6
  +++ XMLDocument.java	28 Jan 2002 22:50:33 -0000	1.7
  @@ -55,6 +55,7 @@
   import java.io.Serializable;
   import java.io.OutputStream;
   import java.io.PrintWriter;
  +import java.io.IOException;
   import java.util.*;
   
   import org.apache.ecs.MultiPartElement;
  @@ -261,6 +262,17 @@
           for (int i=0; i<prolog.size(); i++) {
               ConcreteElement e = (ConcreteElement)prolog.elementAt(i);
               e.output(out);
  +            // XXX really this should use line separator!
  +            // XXX should also probably check for pretty print
  +            // XXX also probably have difficulties with encoding
  +            try 
  +            {
  +                out.write('\n');
  +            }
  +            catch(IOException ioe)
  +            {
  +                ioe.printStackTrace(new PrintWriter(out));
  +            }
           }
            
           if (content != null)
  @@ -284,6 +296,9 @@
           for (int i=0; i<prolog.size(); i++) {
               ConcreteElement e = (ConcreteElement)prolog.elementAt(i);
               e.output(out);
  +            // XXX really this should use line separator!
  +            // XXX should also probably check for pretty print
  +            out.println();
           }
           
           if (content != null)
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-ecs/src/java/org/apache/ecs/xml XMLDocument.java

Posted by robert burrell donkin <ro...@mac.com>.
On Monday, January 28, 2002, at 11:03 PM, Jon Scott Stevens wrote:

> on 1/28/02 2:50 PM, "rdonkin@apache.org" <rd...@apache.org> wrote:
>
>> +            // XXX really this should use line separator!
>> +            // XXX should also probably check for pretty print
>> +            // XXX also probably have difficulties with encoding
>> +            try
>> +            {
>> +                out.write('\n');
>> +            }
>
> Why not use the System.getProperty("line.separator")?

well spotted jon :)

i think that i should really be using ConcreteElement.lineSeparator.

problem is that the way that XMLDocument is structured makes it really 
hard to do things properly without major surgery. i've never liked how 
XMLDocument was written but i've never really had any real desire/need to 
rewrite it. hence the path of least resistance...

i'm also not very confident about the encoding logic in XMLDocument. i'd 
need to think about the right way to convert the line.separator string to 
the byte array that's required.

if you think that it's an improvement that's worth the effort, i'll try to 
get up to speed on the encoding and make the change. (but it might take me 
a while)

- robert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-ecs/src/java/org/apache/ecs/xml XMLDocument.java

Posted by Jon Scott Stevens <jo...@latchkey.com>.
on 1/28/02 2:50 PM, "rdonkin@apache.org" <rd...@apache.org> wrote:

> +            // XXX really this should use line separator!
> +            // XXX should also probably check for pretty print
> +            // XXX also probably have difficulties with encoding
> +            try 
> +            {
> +                out.write('\n');
> +            }

Why not use the System.getProperty("line.separator")?

-jon


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>