私はtagsoupを使用して、インターネットからスクレイピングしているHTMLをクリーンアップしていますが、コメント付きのページを解析すると、次のエラーが発生します。
The data "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " is not legal for a JDOM comment: Comment data cannot start with a hyphen.
私はJDOM1.1を使用していますが、実際のクリーニングを行うコードは次のとおりです。
SAXBuilder builder = new org.jdom.input.SAXBuilder("org.ccil.cowan.tagsoup.Parser"); // build
// Don't check the doctype! At our usage rate, we'll get 503 responses
// from the w3.
builder.setEntityResolver(dummyEntityResolver);
Reader in = new StringReader(str);
org.jdom.Document doc = builder.build(in);
String cleanXmlDoc = new org.jdom.output.XMLOutputter().outputString(doc);
何が問題になっているのか、またはこれを修正する方法はありますか?の長いコメント文字列を含むページを解析できる必要があります<!--------- data ------------>