Saving XML to specific location with XML Tools 2 for AppleScript
I am using XML Tools 2 (http://www.latenightsw.com/freeware/XMLTools2/ind开发者_Go百科ex.html) to generate an XML file in AppleScript. I cannot figure out how to save out the generated XML file to a specific location.
set theFilename to "test_xml"
set theXML to ¬
{class:XML element, XML tag:"FinalCutServer", XML contents:{¬
{class:XML element, XML tag:"request", XML attributes:{reqId:"setMd", entityId:"/asset/STRING_TO_BE_REPLACED"}, XML contents:{¬
{class:XML element, XML tag:"params", XML contents:{¬
{class:XML element, XML tag:"mdValue", XML attributes:{fieldName:" Title", dataType:"string"}, XML contents:{"test01"}}}}}}}}
set xmlPath to "Macintosh HD:XMLin:" & theFilename & ".xml" as Unicode text
generate XML theXML saving as xmlPath with generating UTF8
Using the above code, returns the following error: 'error "Bad name for file. some object" number -37' and saves it to the root directory on my HD. Is there anyway to save it directly to a specific location or do I need to save it to the root and then move the file?
I don't know this tool at all and can't help you with specific code. But in general applescript commands require file specifiers or alias's for the paths. Your path is a string so it may not be in the proper format... you could try putting the word file in front of the variable xmlPath. That would make it a proper applescript-style path.
精彩评论