Re: Lists to XML ?
Re: Lists to XML ?
- Subject: Re: Lists to XML ?
- From: Jean-Christophe Helary <email@hidden>
- Date: Sat, 25 Mar 2017 20:39:56 +0900
2) What Steve Mills mentioned about "using setAttributesAsDictionary" to set the <header> attributes
I think he meant setAttributesWithDictionary:. So:
(tmxHeader's setAttributesWithDictionary:{adminlang:"en", datatype:"unknown", segType:"paragraph", ... })
Regarding the use of a dictionary, I found that "o-tmf" was not accepted in that list because of the "-", so I had to add it separately with the original attributeWithName method I had, like this:
(tmxHeader's setAttributesWithDictionary:{creationtool:"xls2tmx", creationtoolversion:"0.1", srclang:myTMsrclang, adminlang:"en", datatype:"unknown", segtype:"paragraph", creationdate:myDateString}) set headerOtmf to (current application's NSXMLNode's attributeWithName:"o-tmf" stringValue:"Microsoft Excel") (tmxHeader's addAttribute:headerOtmf)
I get the same result, except that o-tmf is last in the attribute list, but that's ok because attribute order is irrelevant in XML. But still, I don't find that very elegant... Too bad dictionaries are that picky regarding the syntax of their elements.
Jean-Christophe |
_______________________________________________
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