/** * Get the text in the CDATA block. * @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; StringBuilder sb = new StringBuilder(); while (more()) { c = next(); 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(); } } throw syntaxError("Unclosed CDATA"); }
/** * Return the next entity. These entities are translated to Characters: * <code>& ' > < "</code>. * @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 ampersand) throws JSONException { StringBuilder sb = new StringBuilder(); 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 string = sb.toString(); return unescapeEntity(string); }
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");
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("Bad XML"); throw x.syntaxError("Misshaped close tag"); throw x.syntaxError("Expected 'CDATA['"); token = x.nextMeta(); if (token == null) { throw x.syntaxError("Missing '>' after '<!'."); } else if (token == XML.LT) { i += 1; throw x.syntaxError("Misshaped tag"); throw x.syntaxError("Bad tagName '" + token + "'."); throw x.syntaxError("Misshaped tag"); throw x.syntaxError("Reserved attribute."); token = x.nextToken(); if (!(token instanceof String)) { throw x.syntaxError("Missing value"); throw x.syntaxError("Misshaped tag"); throw x.syntaxError("Misshaped tag"); throw x.syntaxError("Mismatched '" + tagName +
throw x.syntaxError("Expected 'CDATA['"); token = x.nextMeta(); if (token == null) { throw x.syntaxError("Missing '>' after '<!'."); } else if (token == LT) { i += 1; throw x.syntaxError("Mismatched close tag " + token); throw x.syntaxError("Mismatched " + name + " and " + token); throw x.syntaxError("Misshaped close tag"); throw x.syntaxError("Misshaped tag"); token = x.nextToken(); if (!(token instanceof String)) { throw x.syntaxError("Missing value"); throw x.syntaxError("Misshaped tag"); if (token == null) { if (tagName != null) { throw x.syntaxError("Unclosed tag " + tagName); throw x.syntaxError("Misshaped tag");
/** * Get the text in the CDATA block. * @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; StringBuilder sb = new StringBuilder(); while (more()) { c = next(); 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(); } } throw syntaxError("Unclosed CDATA"); }
/** * Return the next entity. These entities are translated to Characters: * <code>& ' > < "</code>. * @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(@SuppressWarnings("unused") char ampersand) throws JSONException { StringBuilder sb = new StringBuilder(); 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 string = sb.toString(); return unescapeEntity(string); }
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");
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("Bad XML"); throw x.syntaxError("Misshaped close tag"); throw x.syntaxError("Expected 'CDATA['"); token = x.nextMeta(); if (token == null) { throw x.syntaxError("Missing '>' after '<!'."); } else if (token == XML.LT) { i += 1; throw x.syntaxError("Misshaped tag"); throw x.syntaxError("Bad tagName '" + token + "'."); throw x.syntaxError("Misshaped tag"); throw x.syntaxError("Reserved attribute."); token = x.nextToken(); if (!(token instanceof String)) { throw x.syntaxError("Missing value"); throw x.syntaxError("Misshaped tag"); throw x.syntaxError("Misshaped tag"); throw x.syntaxError("Mismatched '" + tagName +
throw x.syntaxError("Expected 'CDATA['"); token = x.nextMeta(); if (token == null) { throw x.syntaxError("Missing '>' after '<!'."); } else if (token == LT) { i += 1; throw x.syntaxError("Mismatched close tag " + token); throw x.syntaxError("Mismatched " + name + " and " + token); throw x.syntaxError("Misshaped close tag"); throw x.syntaxError("Misshaped tag"); token = x.nextToken(); if (!(token instanceof String)) { throw x.syntaxError("Missing value"); throw x.syntaxError("Misshaped tag"); if (token == null) { if (tagName != null) { throw x.syntaxError("Unclosed tag " + tagName); throw x.syntaxError("Misshaped tag");
/** * Return the next entity. These entities are translated to Characters: * <code>& ' > < "</code>. * @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>. * @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>. * @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 ampersand) 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 string = sb.toString(); Object object = entity.get(string); return object != null ? object : ampersand + string + ";"; }
/** * Get the text in the CDATA block. * @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; StringBuilder sb = new StringBuilder(); while (more()) { c = next(); 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(); } } throw syntaxError("Unclosed CDATA"); }
/** * Get the text in the CDATA block. * @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 (end()) { 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. * @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 (end()) { 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. * @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 (end()) { 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. * @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 (end()) { 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(); } } }