html-parser icon indicating copy to clipboard operation
html-parser copied to clipboard

Bug: parse 'DOCTYPE' fail.(v0.6.3 is success v0.7.0 is fail)

Open zhuxiujia opened this issue 1 year ago • 1 comments

let html=r#"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "https://raw.githubusercontent.com/rbatis/rbatis/master/rbatis-codegen/mybatis-3-mapper.dtd">
<mapper>
    <insert id="insert">
        'insert into biz_activity'
        <foreach collection="arg" index="key" item="item" open="(" close=")" separator=",">
            '${key}'
        </foreach>
        'values'
        <foreach collection="arg" index="key" item="item" open="(" close=")" separator=",">
            '${item}'
        </foreach>
    </insert></mapper>"#;
let dom = Dom::parse(html).unwrap();
called `Result::unwrap()` on an `Err` value: Parsing(" --> 1:23\n  |\n1 | <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"https://raw.githubusercontent.com/rbatis/rbatis/master/rbatis-codegen/mybatis-3-mapper.dtd\">\n  |                       ^---\n  |\n  = expected attribute key")
thread 'test::test_parser' panicked at 'called `Result::unwrap()` on an `Err` value: Parsing(" --> 1:23\n  |\n1 | <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"https://raw.githubusercontent.com/rbatis/rbatis/master/rbatis-codegen/mybatis-3-mapper.dtd\">\n  |                       ^---\n  |\n  = expected attribute key")', tests\loader_html.rs:18:27
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library\std\src\panicking.rs:593
   1: core::panicking::panic_fmt
             at /rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library\core\src\panicking.rs:67
   2: core::result::unwrap_failed
             at /rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library\core\src\result.rs:1651
   3: enum2$<core::result::Result<alloc::vec::Vec<rbatis_codegen::codegen::loader_html::Element,alloc::alloc::Global>,enum2$<html_parser::error::Error> > >::unwrap<alloc::vec::Vec<rbatis_codegen::codegen::loader_html::Element,alloc::alloc::Global>,enum2$<html_p
             at /rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753\library\core\src\result.rs:1076
   4: loader_html::test::test_parser
             at .\tests\loader_html.rs:7
   5: loader_html::test::test_parser::closure$0
             at .\tests\loader_html.rs:6
   6: core::ops::function::FnOnce::call_once<loader_html::test::test_parser::closure_env$0,tuple$<> >
             at /rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753\library\core\src\ops\function.rs:250
   7: core::ops::function::FnOnce::call_once
             at /rustc/d59363ad0b6391b7fc5bbb02c9ccf9300eef3753/library\core\src\ops\function.rs:250
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

zhuxiujia avatar Jun 17 '23 16:06 zhuxiujia