I'm facing a perplexing bug that has me stumped.
Here's the troublesome code snippet:
function testDoubleQuote() {
var xmlString = '<file><text>Ehf asor nkles pov ujfemniuea zeïerasvrtrw er Beaetrgfbvcyu Nbv., jei of asverqzsda vsdrersza vd. <br /&><br />Ba erq vazerqhg nba lake erqybfa zvay rv asehgr va erqbu: “Er zhfa veqhazf qeyrreqgf?” Rq mnbsr ojgbeq pliyt mnbver zvae htwe nbrefpuk kj bmaner er mejreplrqv mneuijerbvce qtcx xi xghte hrfd erzemnbuyrewzsdez.</text></file>';
var xml = XmlService.parse(xmlString);
var content = xml.getAllContent();
var text = content[0].getValue();
console.log(text);
}
While trying to extract the value using getValue(), GAS gets stuck. Even other methods to retrieve the text don't seem to work properly. Strangely, removing either ï, “ or ” from the string makes it work. Removing any two characters also solves the issue. What could be causing this? Is there a character limit? Or maybe something else is at play here? The debugger just hangs.
I have a script that successfully converts the XML object into a JavaScript object. However, whenever I try to access the text content of the object, the debugger keeps loading indefinitely. While stepping through the code, it hangs on getValue() or getText() or getChildText(name) when trying to fetch that specific text value. It seems like the creation of the object completes, but the functions for those specific values never return, likely due to the asynchronous nature of GAS, which is somehow overlooked.
No matter how much I try, I can't gather more insights from GAS about this issue. Could this be related to XmlService.parse()?