Skip to content

Commit

Permalink
✨ support Xml comment
Browse files Browse the repository at this point in the history
  • Loading branch information
XiYang6666 committed Jul 23, 2024
1 parent 69f03e2 commit 765d427
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ class XmlDocument(
val sb = StringBuilder()
var ptr = 0
while (ptr < content.length) {
// 处理注释
if (content.substring(ptr..ptr + 3) == "<!--") {
val endCommentIndex = content.indexOf("-->", ptr + 4)
ptr = endCommentIndex + 3
continue
}
// 处理闭标签
if (content[ptr] == '<' && content[ptr + 1] == '/') {
if (sb.isNotEmpty()) {
Expand Down
1 change: 1 addition & 0 deletions Mitori-Satori/src/test/kotlin/XmlParserTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class XmlParserTest {
1145144<br/>
1919810&quot;&#x30;
awawawaw
<!-- awa -->
<p>
awa
<a href="/login">login</a>
Expand Down

0 comments on commit 765d427

Please sign in to comment.