diff options
Diffstat (limited to 'xml/src/main')
-rw-r--r-- | xml/src/main/java/org/kxml2/io/KXmlParser.java | 5 | ||||
-rw-r--r-- | xml/src/main/java/org/kxml2/io/KXmlSerializer.java | 15 |
2 files changed, 7 insertions, 13 deletions
diff --git a/xml/src/main/java/org/kxml2/io/KXmlParser.java b/xml/src/main/java/org/kxml2/io/KXmlParser.java index 5cd2810..9fb858b 100644 --- a/xml/src/main/java/org/kxml2/io/KXmlParser.java +++ b/xml/src/main/java/org/kxml2/io/KXmlParser.java @@ -992,14 +992,14 @@ public class KXmlParser implements XmlPullParser, Closeable { return ELEMENTDECL; // <!EL case 'N': return ENTITYDECL; // <!EN - default: - throw new XmlPullParserException("Unexpected <!", this, null); } + break; case 'A': return ATTLISTDECL; // <!A case 'N': return NOTATIONDECL; // <!N } + throw new XmlPullParserException("Unexpected <!", this, null); default: return START_TAG; // < } @@ -1660,6 +1660,7 @@ public class KXmlParser implements XmlPullParser, Closeable { break; } } + break; default: // handle a byte order mark followed by something other than <? diff --git a/xml/src/main/java/org/kxml2/io/KXmlSerializer.java b/xml/src/main/java/org/kxml2/io/KXmlSerializer.java index 68259e0..d676c41 100644 --- a/xml/src/main/java/org/kxml2/io/KXmlSerializer.java +++ b/xml/src/main/java/org/kxml2/io/KXmlSerializer.java @@ -91,9 +91,7 @@ public class KXmlSerializer implements XmlSerializer { writer.write(close ? " />" : ">"); } - private final void writeEscaped(String s, int quot) - throws IOException { - + private final void writeEscaped(String s, int quot) throws IOException { for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); switch (c) { @@ -114,14 +112,11 @@ public class KXmlSerializer implements XmlSerializer { case '<' : writer.write("<"); break; - case '"' : - case '\'' : + default: if (c == quot) { - writer.write( - c == '"' ? """ : "'"); + writer.write(c == '"' ? """ : "'"); break; } - default : // BEGIN android-changed: refuse to output invalid characters // See http://www.w3.org/TR/REC-xml/#charsets for definition. // No other Java XML writer we know of does this, but no Java @@ -164,9 +159,7 @@ public class KXmlSerializer implements XmlSerializer { public void endDocument() throws IOException { while (depth > 0) { - endTag( - elementStack[depth * 3 - 3], - elementStack[depth * 3 - 1]); + endTag(elementStack[depth * 3 - 3], elementStack[depth * 3 - 1]); } flush(); } |