#278 Scan Script With Tags InComment

open
nobody
5
2010-03-19
2010-03-18
john wang
No

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>";

Discussion

  • john wang
    john wang
    2010-03-18

    the complete html page

     
    Attachments
  • Derrick Oswald
    Derrick Oswald
    2010-03-18

    • status: open --> pending
     
  • Derrick Oswald
    Derrick Oswald
    2010-03-18

    Did you try setting:
    org.htmlparser.scanners.ScriptScanner.STRICT = false;
    ?

    Assuming not, and setting the status Pending.

     
  • john wang
    john wang
    2010-03-19

    • status: pending --> open
     
  • john wang
    john wang
    2010-03-19

    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);
    }