Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
SAX 解析器可以处理自结束标记吗?还是会导致错误?例如<br/> or <hr/>
<br/> or <hr/>
被称为空标签。SAX 解析器不会给出错误。
如果您在 XML 而不是 HTML 模式中使用 SAX 解析器,那么可以,它可以处理自闭合标签。注意:自闭合标签是有效的 XML,但在技术上不是有效的 HTML。
有效的 HTML: <br> <div></div>
<br> <div></div>
有效的 XML: <br/> <div></div> <div/>
<br/> <div></div> <div/>