• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: XML Suite Documentation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XML Suite Documentation


  • Subject: Re: XML Suite Documentation
  • From: Le Stang Jean-Baptiste <email@hidden>
  • Date: Fri, 16 Jun 2006 08:35:52 +0200


On Jun 16, 2006, at 2:55 AM, Jon Pugh wrote:

Personally, I think XML access libraries need random access via object specifiers. You know, "set element x of element y to z". Wouldn't that make munging XML plists a lot nicer?

Using object specifiers would surely make things a lot easier but also a lot longer when you're trying to access elements that are really deep in a XML tree. This is not the kind of implementation they have choose allow you to process XML documents very quickly.


If I use the XML document provided by Chris Nebel :

<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>

The following script for System Events :

tell application "System Events"
	set d to XML file "~/Desktop/toto.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

And this one with the XMLLib.osax :

set thexml to XMLOpen alias "jMiniMac:Users:jeanbaptiste:Desktop:toto.xml"
set theroot to XMLRoot thexml
XMLGetText (XMLXPath theroot with "//dm:url" namespace {nsprefix:"dm", nsurl:"http://purl.org/NET/webdav/mount"})


The first script run in 0.01, and the other one in 0.002 (and this is a really simple one, and they rely underneath on the same C library), in some cases, I think that getting rid of the object model is simple a good idea because you can get really better performances and IMHO, XML processing is one of those cases.

--
Jean-Baptiste LE STANG

Jon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (Applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
40lestang.org


This email sent to email@hidden


_______________________________________________ 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
  • Follow-Ups:
    • Re: XML Suite Documentation
      • From: Le Stang Jean-Baptiste <email@hidden>
References: 
 >XML Suite Documentation (From: email@hidden)
 >Re: XML Suite Documentation (From: Christopher Nebel <email@hidden>)
 >Re: XML Suite Documentation (From: Malcolm Fitzgerald <email@hidden>)
 >Re: XML Suite Documentation (From: Jon Pugh <email@hidden>)

  • Prev by Date: Re: XML Suite Documentation
  • Next by Date: Re: XML Suite Documentation
  • Previous by thread: Re: XML Suite Documentation
  • Next by thread: Re: XML Suite Documentation
  • Index(es):
    • Date
    • Thread