2003/03/26 17:44:35
authorandrew <andrew@xwt.org>
Fri, 30 Jan 2004 06:57:33 +0000 (06:57 +0000)
committerandrew <andrew@xwt.org>
Fri, 30 Jan 2004 06:57:33 +0000 (06:57 +0000)
darcs-hash:20040130065733-4635c-b3bc0c9c5a9cfe28cf86e31751b422d6f616ca4c.gz

src/org/xwt/XML.java

index e995795..afd2c3a 100644 (file)
@@ -228,6 +228,7 @@ public abstract class XML {
         public static final int discardSaveAndChange = 19;
         public static final int saveAndChange = 20;
         public static final int change = 21;
+        public static final int writeAsWS = 22;
         
         public static final int inSkipping = 0;
         public static final int inSTag = 1;
@@ -442,16 +443,7 @@ public abstract class XML {
                         
                         if (buffer.read() != '-') continue; // not "<!--"
 
-                        char[] lastthree = new char[3];
-                        int pos = 0;
-                        while(true) {
-                            currentChar = buffer.read();
-                            lastthree[pos] = (char)currentChar; 
-                            if (lastthree[pos] == '>' && lastthree[(pos + 2) % 3] == '-' && lastthree[(pos + 1) % 3] == '-') break;
-                            pos = (pos + 1) % 3;
-                        }
-
-                        state = operands[inCharData];
+                        state = operands[inComment];
                         continue;  // change state to operand
 
                     case endComment:
@@ -461,7 +453,9 @@ public abstract class XML {
                             // deal with the case where we might have "------->"
                             while ((currentChar = buffer.read()) == '-');
                             
-                            if (currentChar == '>') break;  // end of comment, change state to operand
+                            if (currentChar == '>') {
+                                state = operands[inCharData];
+                            }
                         }
                         
                         continue;   // not end of comment, don't change state
@@ -590,6 +584,10 @@ public abstract class XML {
                         buffer.write(currentChar);
                         break;  // change state to operand
                         
+                    case writeAsWS:
+                        buffer.write((currentChar == '\n' ? currentChar : (char)32));
+                        break;
+
                     case discardAndChange:
                         // throw saved characters away and change state
                         
@@ -897,7 +895,8 @@ public abstract class XML {
             "\u0a15\u110f\u110f\u110e\u110f\u110f\u110f\u110f\u110f\u110f\u110f\u110f\u110f\u1811\u110f",
             "\u1d11\u1d11\u1d11\u1d11\u1d11\u1d11\u1d11\u1d11\u1d11\u130c\u1d11\u1408\u1d11\u1811\u1515",
             "\u130f\u130f\u130f\u130f\u130f\u130f\u130f\u130f\u130f\u130f\u110d\u130f\u130f\u1811\u130f",
-            "\u1415\u1415\u1415\u1415\u1415\u1415\u1415\u1415\u1415\u1415\u1415\u0009\u1415\u1811\u1415",
+            "\u1416\u1416\u1416\u1416\u1416\u1416\u1416\u1416\u1416\u1416\u1416\u0009\u1416\u1811\u1416",
+//            "\u1415\u1415\u1415\u1415\u1415\u1415\u1415\u1415\u1415\u1415\u1415\u0009\u1415\u1811\u1415",
             "\u150a\u000b\u1515\u1515\u1515\u1515\u1515\u1515\u1515\u1515\u1515\u1515\u1515\u1811\u1515",
             "expected Element",
             "unexpected character in tag",