Need a reference for a simple real-time or same-day close fund prices

Like this:

tell application id "com.apple.Safari" -- Safari
	set theSource to source of document 1
end tell
set {theXMLDoc, theError} to current application's NSXMLDocument's alloc()'s initWithXMLString:theSource options:(current application's NSXMLDocumentTidyHTML) |error|:(reference)
if theXMLDoc = missing value then error (theError's localizedDescription() as text)

Hi Shane,

I tried your code on a mid-size web page (codemunki.com/LufkinTools/index.html) and found that the returned XMLDoc is cut short and has this message appended to the end:

<<description truncated at 2000 characters out of 10635>>

Is the XMLDoc actually being truncated or is the result clipped only for display purposes? If the truncation is actually happening, can it be disabled?

Thanks,
Stan C.

It’s for display (and performance) purposes. You can change the amount of truncation using the expert preference key PrefDescriptionOtherLimit, which defaults to 2000. I’ve updated the entry here to cover it:

A bug in earlier Script Debugger 6 versions meant the setting did nothing, but it should work as described in both the latest release of 6 as well as 7.

But everything is actually still there!

Just to add to this…

Script Debugger uses various methods to display Cocoa objects. In many cases what you see is the result of calling the debugDescription method on the object. Depending on the class, the result of this can vary from very terse to quite detailed. In some common cases we clean it up quite a bit, to make it appear more AppleScript-like. In the case of NSXMLDocument, it is the full text of XML.

If you want to see the full description raw, you can also call the method yourself. For example:

log (theXMLDoc's |description|() as text)

For occasional use, this is probably preferable than setting the default to large number. But some descriptions are very long.

Hi Shane,

Got it. That confirms my suspicion. Many thanks for your helpful insights.

Stan C.