/** true iff we have encountered an LI more recently than the last OL/UL */
private static boolean withinLI = false;
- public static synchronized JS parseReader(Reader r) throws IOException {
+ public static synchronized JS parseReader(Reader r) throws IOException, JSExn {
CharStream cs = new CharStream(r);
JS h = new JS();
* facilitate correcting broken HTML. Otherwise, this returns
* null.
*/
- private static String parseElement(CharStream cs, JS h) throws IOException {
+ private static String parseElement(CharStream cs, JS h) throws IOException, JSExn {
// scan element name
while(Character.isSpace(cs.peek())) cs.get();
String elementName = parseElementName(cs);
* positioned at the character immediately after the right
* bracket closing the start-tag
*/
- private static String parseBody(CharStream cs, JS h, String elementName) throws IOException {
+ private static String parseBody(CharStream cs, JS h, String elementName) throws IOException, JSExn {
String cdata = "";
int length = h.get("$numchildren") == null ? 0 : Integer.parseInt(h.get("$numchildren").toString());
while(true) {
/** Parses an element name and returns it. The CharStream should
* be positioned at the first character of the name.
*/
- private static String parseElementName(CharStream cs) throws IOException {
+ private static String parseElementName(CharStream cs) throws IOException, JSExn {
String ret = "";
while (cs.peek() != '>' && !Character.isSpace(cs.peek())) ret += cs.get();
return ret.toLowerCase();
* be positioned at the first character of the name, possibly
* with intervening whitespace.
*/
- private static String parseAttributeName(CharStream cs) throws IOException {
+ private static String parseAttributeName(CharStream cs) throws IOException, JSExn {
while(Character.isSpace(cs.peek())) cs.get();
String ret = "";
while(!Character.isSpace(cs.peek()) && cs.peek() != '=' && cs.peek() != '>') ret += cs.get();
* should be positioned at the equals sign, possibly with
* intervening whitespace.
*/
- private static String parseAttributeValue(CharStream cs) throws IOException {
+ private static String parseAttributeValue(CharStream cs) throws IOException, JSExn {
// eat whitespace and equals sign
while(Character.isSpace(cs.peek())) cs.get();
/** Parses a comment and returns its body. The CharStream should
* be positioned immediately after the <!--
*/
- private static String parseComment(CharStream cs) throws IOException {
+ private static String parseComment(CharStream cs) throws IOException, JSExn {
int dashes = 0;
String ret = "";
while(true) {
}
/** Expands all SGML entities in string <tt>s</tt> */
- public static String expandEntities(String s) throws IOException {
+ public static String expandEntities(String s) throws IOException, JSExn {
if (s.indexOf('&') == -1) return s;
StringBuffer sb = new StringBuffer();
int i=0;
}
/** removes all redundant whitespace */
- private static String removeRedundantWhitespace(String s) {
+ private static String removeRedundantWhitespace(String s) throws JSExn {
if (s.indexOf(' ') == -1 && s.indexOf('\n') == -1 && s.indexOf('\t') == -1 && s.indexOf('\r') == -1) return s;