I'm experimenting with Kotlin JS before using it in a project.
I'd like to parse a HTML doc using xpath
specifications that the user is prompted to upload to the site.
import kotlinx.browser.document
val h1 = document.asDynamic().evaluate("//h1", getDocument())
println("xpath h1=${h1}")
return h1
In a browser console window, the println
displays xpath h1=[object XPathResult]
Two questions:
is
…evaluate() a good approach for XPath parsing in Kotlin JS
?where is
XPathResult
defined in Kotlin JS? Intellij doesn't offer to add an appropriate import.