[Yanel-commits] rev 22851 - public/yanel/trunk/src/core/java/org/wyona/yanel/core/serialization

josias at wyona.com josias at wyona.com
Thu Feb 22 02:09:41 CET 2007


Author: josias
Date: 2007-02-22 02:08:53 +0100 (Thu, 22 Feb 2007)
New Revision: 22851

Modified:
   public/yanel/trunk/src/core/java/org/wyona/yanel/core/serialization/HTMLSerializer.java
Log:
added workaround for a namespace problem, and made it work on non-utf platforms

Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/serialization/HTMLSerializer.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/serialization/HTMLSerializer.java	2007-02-21 21:46:56 UTC (rev 22850)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/serialization/HTMLSerializer.java	2007-02-22 01:08:53 UTC (rev 22851)
@@ -19,7 +19,7 @@
 
     private static Category log = Category.getInstance(HTMLSerializer.class);
     private EntityResolver entityResolver;
-    private String pendingElement;
+    private String pendingElement = null;
     private boolean doIndent;
     
     private String[] nonCollapsableElements = { "textarea", "script", "style" };
@@ -64,6 +64,10 @@
         handlePendingElement();
         String eName = ("".equals(localName)) ? qName : localName;
         
+        if (localName.equals("html")) {
+            print("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
+            return;
+        }
         StringBuffer element = new StringBuffer();
         element.append("<" + eName);
         for(int i = 0; i < attrs.getLength(); i++) {
@@ -168,7 +172,7 @@
     
     protected void print(String s) throws SAXException {
         try {
-            this.os.write(replaceAmpersand(s).getBytes());
+            this.os.write(replaceAmpersand(s).getBytes("UTF-8"));
         } catch (IOException e) {
             log.error(e.getMessage(), e);
             throw new SAXException(e);
@@ -233,7 +237,6 @@
     }
 
     public void endEntity(String name) throws SAXException {
-        System.out.println("start entity: " + name);
         // TODO Auto-generated method stub
     }
 




More information about the Yanel-commits mailing list