Hello
I’m writing a script where I need to parse an HTML file. Therefor I use XML tools library from LateNightSoftware. But when I parsed an HTML file with the parse XML command it ignored the whitespace. So for example when I ran this:
parse XML "<html>
<body>
<p>Some <b>bold</b> text</p>
</body>
</html>
"
It returned this {class:XML document, XML tag:“html”, XML contents:{{class:XML element, XML tag:“body”, XML contents:{{class:XML element, XML tag:“p”, XML contents:{“Some”, {class:XML element, XML tag:“b”, XML contents:{“bold”}}, “text”}}}}}}
Notice that there is no space after “Some” So I found in the library that there was an option “preserving whitespace”
but when I used that in another script:
parse XML "<html>
<body>
<p>Some <b>bold</b> text</p>
</body>
</html>
" with preserving whitespace
It also included the returns and thats not what I wanted. I just wanted to parse the xml the way a browser does (reduce more than one spaces or returns to one space). Can anybody help me with this?
Thanks in advance
Damiaan
AppleScript: Versie 2.4.2 (131)
Browser: Safari 534.55.3
Operating System: Mac OS X (10.7)