tXml
tXml copied to clipboard
Properly parse unquoted attributes (pleaseš?)
Whenever I parse this string:
<p type=bold>hello mom!</p>
I get unexpected results:
{
tagName:"p",
attributes:{
type:null,
bold:null
},
children:["hello mom!"]
}
I know this is an xml parser but wouldn't it just make sense to generate:
{
tagName:"p",
attributes:{
type:"bold"
},
children:["hello mom!"]
}
Please consider adding such type parsing in the next bug fix, I love your library! š„°š„°
thanks, this really is a bug. I can confirm it, in a quick test.
it need to be fixed in the parseNode
method between line 200 and 220:
https://github.com/TobiasNickel/tXml/blob/0dddcb277d206fb319f29da73932efecbe300137/tXml.js#L199-L224
To be honest, even I find the code at line 204 a bit difficult to read, But with spending some time we should be able to figure this out.
but that one is invalid xml right? there's suppose to be quote (single or double) around bold
?
<p type="bold">hello mom!</p>
right, but still many html pages do not have quotes. the values then can not contain any space.