cezheng / Fuzi

A fast & lightweight XML & HTML parser in Swift with XPath & CSS support
MIT License
1.07k stars 156 forks source link

firstChild does not properly work with tag name `text` #120

Open Igor-Palaguta opened 2 years ago

Igor-Palaguta commented 2 years ago

Description:

Environment

How to reproduce:

<parent>
   <text>Some text</text>
</parent>

parent.firstChild(tag: "text")?.stringValue == " \n" instead of parent.firstChild(tag: "text")?.stringValue == "Some text" parent.firstChild(tag: "text")?.type == .Text instead of parent.firstChild(tag: "text")?.type == .Element

parent.children(tag: "text") finds proper nodes as it checks also element type

Igor-Palaguta commented 2 years ago

@cezheng please have a look at https://github.com/cezheng/Fuzi/pull/121