Re: Lists to XML ?
Re: Lists to XML ?
- Subject: Re: Lists to XML ?
- From: Jean-Christophe Helary <email@hidden>
- Date: Fri, 24 Mar 2017 10:30:34 +0900
I'm basically trying to convert the "used range" of an Excel sheet into a specific XML dialect but I'm not seeing any dictionary item that could help.
That's a difficult question to answer without knowing what format XML you want. System Events has an XML Suite, but I'm not sure it will give you an XML string for anything but a complete document. It's also incredibly slow for anything not very simple.
And the other option is AppleScriptObjC. Here's something very simple:
Shane, that's exactly what I was looking for.
Of course, what I'm intending to do is slightly more complex, but now I know that I just need to fiddle with the XMLNode class to find what I need. Excellent :)
Jean-Christophe
use AppleScript version "2.4" -- Yosemite (10.10) or later use framework "Foundation" use scripting additions
set theList to {"a", "b", 1, 2, 3.3} set listElement to current application's NSXMLNode's elementWithName:"array" repeat with anItem in theList set newNode to (current application's NSXMLNode's elementWithName:"entry" stringValue:anItem) (listElement's addChild:newNode) end repeat return listElement's XMLString() as text
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden