using the script from :
http://piyocast.com/as/archives/790
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "XmlToDictKit" --https://github.com/nicklockwood/XMLDictionary
set aFile to POSIX path of (choose file)
set aURL to current application's |NSURL|'s fileURLWithPath:aFile
set xmlString to current application's NSString's alloc()'s initWithContentsOfURL:aURL encoding:(current application's NSUTF8StringEncoding) |error|:(missing value)
if xmlString = missing value then return false
set xmlDoc to (current application's NSDictionary's dictionaryWithXMLString:xmlString) as record
in the framework “XmlToDictKit” the default option is set so that attributes are named
with a “_” in front of them for their dictionary key.
I would like to change this default.
from the readme have found:
@property (nonatomic, assign) XMLDictionaryAttributesMode attributesMode;
This property controls how XML attributes are handled.
The default is XMLDictionaryAttributesModePrefixed meaning that attributes will be included in the dictionary, with an _ (underscore) prefix to avoid namespace collisions.
Alternative values are XMLDictionaryAttributesModeDictionary, which will place all the attributes in a separate dictionary, XMLDictionaryAttributesModeUnprefixed, which includes the attributes without prefix (which may cause collisions with nodes) and XMLDictionaryAttributesModeDiscard, which will strip the attributes.
from the framework header (XMLDictionary.h):
typedef NS_ENUM(NSInteger, XMLDictionaryAttributesMode)
{
XMLDictionaryAttributesModePrefixed = 0, //default
XMLDictionaryAttributesModeDictionary,
XMLDictionaryAttributesModeUnprefixed,
XMLDictionaryAttributesModeDiscard
};
I would like to via my applescript set the Framework XMLDictionaryAttributesMode to XMLDictionaryAttributesModeUnprefixed
can someone guide me on how to accomplish this via Applescript?
Or do I need to hardcode the framework header to set the default?
thanks