Re: XML Suite Documentation
Re: XML Suite Documentation
- Subject: Re: XML Suite Documentation
- From: Christopher Nebel <email@hidden>
- Date: Wed, 14 Jun 2006 14:41:59 -0700
On Jun 11, 2006, at 10:12 PM, email@hidden wrote:
Where can I find documentation on the AppleScript XML Suite in Tiger?
I tried to write a script to parse .davmount files & mount WebDAV
resources -
http://greenbytes.de/tech/webdav/draft-reschke-webdav-mount-
latest.html
However I looked on developer.apple.com, Google, & in AppleScript Help
for documentation on the AppleScript XML Suite in Tiger - no luck
Unfortunately, there isn't any. However, it's pretty simple [1].
For example, in your case:
/tmp/dm.xml:
<dm:mount xmlns:dm='http://purl.org/NET/webdav/mount'>
<dm:url>http://www.example.com/user42/</dm:url>
<dm:open>inbox/</dm:open>
</dm:mount>
script:
tell application "System Events"
set d to XML file "/tmp/dm.xml"
-- HFS paths work too. If you have the XML data in a string, you
-- could say "set d to make new XML data with data "blah".
get value of XML element "dm:url" of XML element 1 of d
--> "http://www.example.com/user42/"
end tell
An interesting wrinkle here is that System Events doesn't really
understand namespaces -- notice that the element type is "dm:url".
That means that if someone gave you a davmount file that used, say,
"dmount" as the namespace prefix, the script wouldn't work.
A related question - anyone know how to associate an application -
script applet in this case - with the .davmount extension or
application/davmount+xml mimetype?
This is part of an application's Info.plist; see <http://
developer.apple.com/documentation/Carbon/Conceptual/
LaunchServicesConcepts/LSCConcepts/chapter_2_section_4.html> under
"URL Types", or <http://developer.apple.com/documentation/MacOSX/
Conceptual/BPRuntimeConfig/Articles/PListKeys.html> under
"CFBundleURLTypes". If you're using Script Editor, you'll need to
save your script as an application bundle and give it a unique
CFBundleIdentifier and signature first. If you're using AppleScript
Studio, you're forced to do both of those already.
--Chris Nebel
AppleScript Engineering
[1] Can someone (ideally someone it happened to) please explain how
they got stuck? It would help in writing the documentation. To me,
the dictionary seems perfectly straightforward -- files/data have
elements, elements have a value, attributes, and other elements --
but then, I already know what "element" and "attribute" mean in XML...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden