Hello,

Before, if you created an XML object with "needs ending tag" to false
(in other words, if you wanted to create something like <tag/>), then
ECS would print out <tag>.  Here is the patch to make ECS print out
<tag/> if you want a tag w/ no ending tag.

(Note that this patch also includes the patch to pretty print and keep
white space correct since my additions haven't been added into the CVS
yet)

I hope people find them useful.

Index: XML.java
===================================================================
RCS file:
/products/cvs/master/ecs/src/java/org/apache/ecs/xml/XML.java,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 XML.java
64c64
< public class XML extends MultiPartElement
---
> public class XML extends MultiPartElement implements Printable
188c188,222
< }
\ No newline at end of file
---
> 
>     public boolean getNeedLineBreak() {
>         boolean linebreak = true;
> 
>         java.util.Enumeration enum = elements();
> 
>         // if this tag has one child, and it's a String, then don't
>         // do any linebreaks to preserve whitespace
>         int i = 0;
>         int j = 0;
>         while (enum.hasMoreElements()) {
>             i++;
>             Object obj = enum.nextElement();
>             if (obj instanceof StringElement)
>                 j++;
>         }
>         if (i ==j)
>             linebreak = false;
> 
>         return linebreak;
>     }
> 
>     public boolean getBeginEndModifierDefined() {
>         boolean answer = false;
> 
>         if (! this.getNeedClosingTag())
>             answer = true;
> 
>         return answer;
>     }
> 
>     public char getBeginEndModifier() {
>         return '/';
>     }
> }


--
------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to