@@ -31,11 +31,11 @@ of this software and associated documentation files (the "Software"), to deal
3131 * This provides static methods to convert an XML text into a JSONObject,
3232 * and to covert a JSONObject into an XML text.
3333 * @author JSON.org
34- * @version2011-02-11
34+ * @version2012-10-26
3535 */
3636public class XML {
3737
38- /** The Character '&'. */
38+ /** The Character '& '. */
3939public static final Character AMP =new Character ('&' );
4040
4141/** The Character '''. */
@@ -50,7 +50,7 @@ public class XML {
5050/** The Character '>'. */
5151public static final Character GT =new Character ('>' );
5252
53- /** The Character '< '. */
53+ /** The Character '< '. */
5454public static final Character LT =new Character ('<' );
5555
5656/** The Character '?'. */
@@ -99,9 +99,9 @@ public static String escape(String string) {
9999 }
100100return sb .toString ();
101101 }
102-
102+
103103/**
104- * Throw an exception if the string contains whitespace.
104+ * Throw an exception if the string contains whitespace.
105105 * Whitespace is not allowed in tagNames and attributes.
106106 * @param string
107107 * @throws JSONException
@@ -113,7 +113,7 @@ public static void noSpace(String string) throws JSONException {
113113 }
114114for (i =0 ;i <length ;i +=1 ) {
115115if (Character .isWhitespace (string .charAt (i ))) {
116- throw new JSONException ("'" +string +
116+ throw new JSONException ("'" +string +
117117"' contains a space character." );
118118 }
119119 }
@@ -196,7 +196,7 @@ private static boolean parse(XMLTokener x, JSONObject context,
196196token =x .nextToken ();
197197if (name ==null ) {
198198throw x .syntaxError ("Mismatched close tag " +token );
199- }
199+ }
200200if (!token .equals (name )) {
201201throw x .syntaxError ("Mismatched " +name +" and " +token );
202202 }
@@ -229,7 +229,7 @@ private static boolean parse(XMLTokener x, JSONObject context,
229229if (!(token instanceof String )) {
230230throw x .syntaxError ("Missing value" );
231231 }
232- jsonobject .accumulate (string ,
232+ jsonobject .accumulate (string ,
233233XML .stringToValue ((String )token ));
234234token =null ;
235235 }else {
@@ -262,7 +262,7 @@ private static boolean parse(XMLTokener x, JSONObject context,
262262 }else if (token instanceof String ) {
263263string = (String )token ;
264264if (string .length () >0 ) {
265- jsonobject .accumulate ("content" ,
265+ jsonobject .accumulate ("content" ,
266266XML .stringToValue (string ));
267267 }
268268
@@ -274,7 +274,7 @@ private static boolean parse(XMLTokener x, JSONObject context,
274274context .accumulate (tagName ,"" );
275275 }else if (jsonobject .length () ==1 &&
276276jsonobject .opt ("content" ) !=null ) {
277- context .accumulate (tagName ,
277+ context .accumulate (tagName ,
278278jsonobject .opt ("content" ));
279279 }else {
280280context .accumulate (tagName ,jsonobject );
@@ -295,7 +295,7 @@ private static boolean parse(XMLTokener x, JSONObject context,
295295 * Try to convert a string into a number, boolean, or null. If the string
296296 * can't be converted, return the string. This is much less ambitious than
297297 * JSONObject.stringToValue, especially because it does not attempt to
298- * convert plus forms, octal forms, hex forms, or E forms lacking decimal
298+ * convert plus forms, octal forms, hex forms, or E forms lacking decimal
299299 * points.
300300 * @param string A String.
301301 * @return A simple JSON value.
@@ -317,7 +317,7 @@ public static Object stringToValue(String string) {
317317return new Integer (0 );
318318 }
319319
320- // If it might be a number, try converting it. If that doesn't work,
320+ // If it might be a number, try converting it. If that doesn't work,
321321// return the string.
322322
323323try {
@@ -347,7 +347,7 @@ public static Object stringToValue(String string) {
347347return string ;
348348 }
349349
350-
350+
351351/**
352352 * Convert a well-formed (but not necessarily valid) XML string into a
353353 * JSONObject. Some information may be lost in this transformation
@@ -505,4 +505,4 @@ public static String toString(Object object, String tagName)
505505 }
506506 }
507507 }
508- }
508+ }