mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
Season's Greetings
This commit is contained in:
parent
f284477cff
commit
87c4b1d59d
13 changed files with 562 additions and 566 deletions
|
@ -28,7 +28,7 @@ SOFTWARE.
|
|||
* The XMLTokener extends the JSONTokener to provide additional methods
|
||||
* for the parsing of XML texts.
|
||||
* @author JSON.org
|
||||
* @version 2010-01-30
|
||||
* @version 2010-12-24
|
||||
*/
|
||||
public class XMLTokener extends JSONTokener {
|
||||
|
||||
|
@ -120,11 +120,11 @@ public class XMLTokener extends JSONTokener {
|
|||
/**
|
||||
* Return the next entity. These entities are translated to Characters:
|
||||
* <code>& ' > < "</code>.
|
||||
* @param a An ampersand character.
|
||||
* @param ampersand An ampersand character.
|
||||
* @return A Character or an entity String if the entity is not recognized.
|
||||
* @throws JSONException If missing ';' in XML entity.
|
||||
*/
|
||||
public Object nextEntity(char a) throws JSONException {
|
||||
public Object nextEntity(char ampersand) throws JSONException {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (;;) {
|
||||
char c = next();
|
||||
|
@ -136,9 +136,9 @@ public class XMLTokener extends JSONTokener {
|
|||
throw syntaxError("Missing ';' in XML entity: &" + sb);
|
||||
}
|
||||
}
|
||||
String s = sb.toString();
|
||||
Object e = entity.get(s);
|
||||
return e != null ? e : a + s + ";";
|
||||
String string = sb.toString();
|
||||
Object object = entity.get(string);
|
||||
return object != null ? object : ampersand + string + ";";
|
||||
}
|
||||
|
||||
|
||||
|
@ -304,15 +304,15 @@ public class XMLTokener extends JSONTokener {
|
|||
int i;
|
||||
int j;
|
||||
int offset = 0;
|
||||
int n = to.length();
|
||||
char[] circle = new char[n];
|
||||
int length = to.length();
|
||||
char[] circle = new char[length];
|
||||
|
||||
/*
|
||||
* First fill the circle buffer with as many characters as are in the
|
||||
* to string. If we reach an early end, bail.
|
||||
*/
|
||||
|
||||
for (i = 0; i < n; i += 1) {
|
||||
for (i = 0; i < length; i += 1) {
|
||||
c = next();
|
||||
if (c == 0) {
|
||||
return false;
|
||||
|
@ -328,14 +328,14 @@ public class XMLTokener extends JSONTokener {
|
|||
/*
|
||||
* Compare the circle buffer with the to string.
|
||||
*/
|
||||
for (i = 0; i < n; i += 1) {
|
||||
for (i = 0; i < length; i += 1) {
|
||||
if (circle[j] != to.charAt(i)) {
|
||||
b = false;
|
||||
break;
|
||||
}
|
||||
j += 1;
|
||||
if (j >= n) {
|
||||
j -= n;
|
||||
if (j >= length) {
|
||||
j -= length;
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
@ -357,8 +357,8 @@ public class XMLTokener extends JSONTokener {
|
|||
*/
|
||||
circle[offset] = c;
|
||||
offset += 1;
|
||||
if (offset >= n) {
|
||||
offset -= n;
|
||||
if (offset >= length) {
|
||||
offset -= length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue