method testScanScriptWithTagsInComment in ScriptScannerTest can't pass this use case:
String javascript2="\"2010-3-17-9\",//投放开始时间<startdate>2010-3-17</startdate>\"2010-3-18-9\",//投放结束时间非单天要加1<enddate>2010-3-18</enddate>";
yes ,i did set : org.htmlparser.scanners.ScriptScanner.STRICT = false;
here is the full test method refered test case from the html parser sourc package:
public void testScanScriptWithTagsInComment() throws ParserException {
org.htmlparser.scanners.ScriptScanner.STRICT = false;
String javascript = "\n// This is javascript with <li> tag in the comment\n";
String javascript2="\"2010-3-17-9\",//投放开始时间<startdate>2010-3-17</startdate>\"2010-3-18-9\",//投放结束时间非单天要加1<enddate>2010-3-18</enddate>";
createParser("<script>"+ javascript2 + "</script>");
parseAndAssertNodeCount(1);
assertTrue("Node should be a script tag",node[0] instanceof ScriptTag);
ScriptTag scriptTag = (ScriptTag)node[0];
String scriptCode = scriptTag.getScriptCode();
assertStringEquals("Expected Code",javascript,scriptCode);
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
the complete html page
Did you try setting:
org.htmlparser.scanners.ScriptScanner.STRICT = false;
?
Assuming not, and setting the status Pending.
yes ,i did set : org.htmlparser.scanners.ScriptScanner.STRICT = false;
here is the full test method refered test case from the html parser sourc package:
public void testScanScriptWithTagsInComment() throws ParserException {
org.htmlparser.scanners.ScriptScanner.STRICT = false;
String javascript = "\n// This is javascript with <li> tag in the comment\n";
String javascript2="\"2010-3-17-9\",//投放开始时间<startdate>2010-3-17</startdate>\"2010-3-18-9\",//投放结束时间非单天要加1<enddate>2010-3-18</enddate>";
createParser("<script>"+ javascript2 + "</script>");
parseAndAssertNodeCount(1);
assertTrue("Node should be a script tag",node[0] instanceof ScriptTag);
ScriptTag scriptTag = (ScriptTag)node[0];
String scriptCode = scriptTag.getScriptCode();
assertStringEquals("Expected Code",javascript,scriptCode);
}