[prev in list] [next in list] [prev in thread] [next in thread]
List: ecs-dev
Subject: cvs commit: jakarta-ecs/src/java/org/apache/ecs ConcreteElement.java
From: rdonkin () apache ! org
Date: 2003-05-13 12:23:18
[Download RAW message or body]
rdonkin 2003/05/13 05:23:18
Modified: src/java/org/apache/ecs ConcreteElement.java
Log:
Changed output so that the current element encoding type is used when the element \
is outputted to an OutputStream.
Revision Changes Path
1.31 +17 -8 jakarta-ecs/src/java/org/apache/ecs/ConcreteElement.java
Index: ConcreteElement.java
===================================================================
RCS file: /home/cvs/jakarta-ecs/src/java/org/apache/ecs/ConcreteElement.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- ConcreteElement.java 7 May 2003 10:19:23 -0000 1.30
+++ ConcreteElement.java 13 May 2003 12:23:18 -0000 1.31
@@ -291,6 +291,15 @@
*/
public static void output(OutputStream out, ConcreteElement ce)
{
+ // use the encoding for the given element
+ String encoding = ce.getCodeSet();
+ if ( encoding == null )
+ {
+ // By default use Big Endian Unicode.
+ // In this way we will not loose any information.
+ encoding = "UTF-16BE";
+ }
+
boolean prettyPrint = ce.getPrettyPrint();
int tabLevel = ce.getTabLevel();
try
@@ -304,11 +313,11 @@
if ((prettyPrint && ce instanceof Printable) && (tabLevel > 0))
ce.putTabs(tabLevel, out);
- out.write(ce.createStartTag().getBytes());
+ out.write(ce.createStartTag().getBytes(encoding));
// If this is a StringElement that has ChildElements still print \
the TagText if(ce.getTagText() != null)
- out.write(ce.getTagText().getBytes());
+ out.write(ce.getTagText().getBytes(encoding));
Enumeration enum = ce.registryList.elements();
@@ -322,7 +331,7 @@
{
if ( ce.getNeedLineBreak() )
{
- out.write(ce.lineSeparator.getBytes());
+ out.write(ce.lineSeparator.getBytes(encoding));
e.setTabLevel(tabLevel + 1);
}
}
@@ -334,12 +343,12 @@
{
if ( ce.getNeedLineBreak() )
{
- out.write(ce.lineSeparator.getBytes());
+ out.write(ce.lineSeparator.getBytes(encoding));
ce.putTabs(tabLevel + 1, out);
}
}
String string = obj.toString();
- out.write(string.getBytes());
+ out.write(string.getBytes(encoding));
}
}
if (ce.getNeedClosingTag())
@@ -348,12 +357,12 @@
{
if ( ce.getNeedLineBreak() )
{
- out.write(ce.lineSeparator.getBytes());
+ out.write(ce.lineSeparator.getBytes(encoding));
if (tabLevel > 0)
ce.putTabs(tabLevel, out);
}
}
- out.write(ce.createEndTag().getBytes());
+ out.write(ce.createEndTag().getBytes(encoding));
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: ecs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: ecs-dev-help@jakarta.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic