/** * Get the text in the CDATA block.<p> * * @return the string up to the <code>]]></code> * @throws JSONException if the <code>]]></code> is not found */ public String nextCDATA() throws JSONException { char c; int i; StringBuffer sb = new StringBuffer(); for (;;) { c = next(); if (c == 0) { throw syntaxError("Unclosed CDATA"); } sb.append(c); i = sb.length() - 3; if ((i >= 0) && (sb.charAt(i) == ']') && (sb.charAt(i + 1) == ']') && (sb.charAt(i + 2) == '>')) { sb.setLength(i); return sb.toString(); } } }
/** * Get the text in the CDATA block.<p> * * @return the string up to the <code>]]></code> * @throws JSONException if the <code>]]></code> is not found */ public String nextCDATA() throws JSONException { char c; int i; StringBuffer sb = new StringBuffer(); for (;;) { c = next(); if (c == 0) { throw syntaxError("Unclosed CDATA"); } sb.append(c); i = sb.length() - 3; if (i >= 0 && sb.charAt(i) == ']' && sb.charAt(i + 1) == ']' && sb.charAt(i + 2) == '>') { sb.setLength(i); return sb.toString(); } } }
/** * Return the next ENTITY. These entities are translated to Characters: * <code>& ' > < "</code>.<p> * * @param a 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 { StringBuffer sb = new StringBuffer(); for (;;) { char c = next(); if (Character.isLetterOrDigit(c) || (c == '#')) { sb.append(Character.toLowerCase(c)); } else if (c == ';') { break; } else { throw syntaxError("Missing ';' in XML ENTITY: &" + sb); } } String s = sb.toString(); Object e = ENTITY.get(s); return e != null ? e : a + s + ";"; }
/** * Return the next ENTITY. These entities are translated to Characters: * <code>& ' > < "</code>.<p> * * @param a 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 { StringBuffer sb = new StringBuffer(); for (;;) { char c = next(); if (Character.isLetterOrDigit(c) || c == '#') { sb.append(Character.toLowerCase(c)); } else if (c == ';') { break; } else { throw syntaxError("Missing ';' in XML ENTITY: &" + sb); } } String s = sb.toString(); Object e = ENTITY.get(s); return e != null ? e : a + s + ";"; }
switch (c) { case 0: throw syntaxError("Misshaped element"); case '<': throw syntaxError("Misplaced '<'"); case '>': return XML.GT; c = next(); if (c == 0) { throw syntaxError("Unterminated string"); case '"': case '\'': throw syntaxError("Bad character in a name"); default:
switch (c) { case 0: throw syntaxError("Misshaped element"); case '<': throw syntaxError("Misplaced '<'"); case '>': return XML.GT; c = next(); if (c == 0) { throw syntaxError("Unterminated string"); case '"': case '\'': throw syntaxError("Bad character in a name"); default:
switch (c) { case 0: throw syntaxError("Misshaped meta tag"); case '<': return XML.LT; c = next(); if (c == 0) { throw syntaxError("Unterminated string");
switch (c) { case 0: throw syntaxError("Misshaped meta tag"); case '<': return XML.LT; c = next(); if (c == 0) { throw syntaxError("Unterminated string");
throw x.syntaxError("Expected 'CDATA['"); t = x.nextMeta(); if (t == null) { throw x.syntaxError("Missing '>' after '<!'."); } else if (t == LT) { i += 1; throw x.syntaxError("Mismatched close tag" + t); throw x.syntaxError("Mismatched " + name + " and " + t); throw x.syntaxError("Misshaped close tag"); throw x.syntaxError("Misshaped tag"); t = x.nextToken(); if (!(t instanceof String)) { throw x.syntaxError("Missing value"); throw x.syntaxError("Misshaped tag"); if (t == null) { if (n != null) { throw x.syntaxError("Unclosed tag " + n); throw x.syntaxError("Misshaped tag");
x.nextCDATA(); } else { throw x.syntaxError("Expected 'CDATA['"); t = x.nextMeta(); if (t == null) { throw x.syntaxError("Missing '>' after '<!'."); } else if (t == XML.LT) { i += 1; throw x.syntaxError("Mismatched close tag '" + t + "'"); throw x.syntaxError("Mismatched '" + ja.get(0) + "' and '" + t + "'"); throw x.syntaxError("Misshaped close tag"); throw x.syntaxError("Misshaped tag"); throw x.syntaxError("Misshaped tag"); t = x.nextToken(); if (!(t instanceof String)) { throw x.syntaxError("Missing value"); throw x.syntaxError("Misshaped tag"); throw x.syntaxError("Misshaped tag");
throw x.syntaxError("Expected 'CDATA['"); t = x.nextMeta(); if (t == null) { throw x.syntaxError("Missing '>' after '<!'."); } else if (t == LT) { i += 1; throw x.syntaxError("Mismatched close tag" + t); throw x.syntaxError("Mismatched " + name + " and " + t); throw x.syntaxError("Misshaped close tag"); throw x.syntaxError("Misshaped tag"); t = x.nextToken(); if (!(t instanceof String)) { throw x.syntaxError("Missing value"); throw x.syntaxError("Misshaped tag"); if (t == null) { if (n != null) { throw x.syntaxError("Unclosed tag " + n); throw x.syntaxError("Misshaped tag");
x.nextCDATA(); } else { throw x.syntaxError("Expected 'CDATA['"); t = x.nextMeta(); if (t == null) { throw x.syntaxError("Missing '>' after '<!'."); } else if (t == XML.LT) { i += 1; throw x.syntaxError("Mismatched close tag '" + t + "'"); throw x.syntaxError("Mismatched '" + ja.get(0) + "' and '" + t + "'"); throw x.syntaxError("Misshaped close tag"); throw x.syntaxError("Misshaped tag"); throw x.syntaxError("Misshaped tag"); t = x.nextToken(); if (!(t instanceof String)) { throw x.syntaxError("Missing value"); throw x.syntaxError("Misshaped tag"); throw x.syntaxError("Misshaped tag");