[quote=“pv”]And another possible bug:
set foo to "<html><body>hello</body></html>"
In “put tree(string:foo)”, it appears to be trying to parse foo as a tree.[/quote]
This isn’t really a bug. The conversion from a property list to a tree operates in a “deep” fashion, doing its best to interpret each value as a possible subtree. So if a value is proper XML it is converted to a subtree at that point.
I can see how that isn’t what you really want in this case, since you just want the html text stored in the tree. For now, you’ve already found one possible way to prevent this. Here’s another way to explicitly specify that you want a text node at some point in a tree, using the special “_text” property:
set html to "<html><body>hello</body></html>"
set xml to tree(value:(_text:html))
Hopefully one of these approaches will work well for your needs.