mirror of
https://github.com/vlang/v.git
synced 2025-09-08 14:51:53 -04:00
encoding.xml: fix parsing for self closing empty tags (#19907)
This commit is contained in:
parent
66181f05bd
commit
1482a2f28d
@ -562,7 +562,7 @@ pub fn parse_single_node(first_char u8, mut reader io.Reader) !XMLNode {
|
||||
tag_contents := contents.str().trim_space()
|
||||
|
||||
parts := tag_contents.split_any(' \t\n')
|
||||
name := parts[0]
|
||||
name := parts[0].trim_right('/')
|
||||
|
||||
// Check if it is a self-closing tag
|
||||
if tag_contents.ends_with('/') {
|
||||
|
@ -7,6 +7,7 @@ const (
|
||||
<c id="c2">
|
||||
Sample Text
|
||||
</c>
|
||||
<empty/>
|
||||
<c id="c3"/>
|
||||
<abc id="c4"/>
|
||||
<xyz id="c5"/>
|
||||
@ -34,6 +35,10 @@ const (
|
||||
'Sample Text',
|
||||
]
|
||||
},
|
||||
XMLNode{
|
||||
name: 'empty'
|
||||
attributes: {}
|
||||
},
|
||||
XMLNode{
|
||||
name: 'c'
|
||||
attributes: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user