I'm writing a program which parses a web page (one which I don't have access to so I can't modify it).
First I connect and use getContent() to get an InputStream for the page. There's no trouble there.
But then when parsing:
public static int[] parseMoveGameList(InputStream is) throws ParserConfigurationException, IOException, SAXException {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dbf.newDocumentBuilder();
Document doc = builder.parse(is);
/*...*/
}
Here builder.parse throws:
org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 64; The system identifier must begin with either a single or double quote character.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:253)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:288)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
at cs.ualberta.lgadapter.LGAdapter.parseMoveGameList(LGAdapter.java:78)
...
The page that I'm parsing (but can't change) looks like
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
<html>
<head>
<META http-equiv="Expires" content="0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<!-- ... -->
</head>
<body>
<!-- ... -->
</body>
</html>
How can I get past this exception?