• 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 script library?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XML script library?


  • Subject: Re: XML script library?
  • From: Shane Stanley <email@hidden>
  • Date: Wed, 04 Mar 2015 18:12:24 +1100

On 4 Mar 2015, at 5:34 pm, Jörgen Stahle <email@hidden> wrote:
>
> Of course I could use a non-objC command for writing the file instead. However, I have experienced problems with that when the resulting xml is very large. Many shell script commands have a limit, a maximum number of characters - for example
> echo ’very long string’ > path.xml.
> The solution has been to always save the xml directly from xml tool I’m using – in my case XML Tools, which does not seem to have that limitation or has a much higher one.
> I guess and hope using ASObjC this way also allows writing very large xml:s

Yes, you shouldn't have any problems. As long as you're not coercing to AppleScript classes, the variables essentially contain just pointers to the Cocoa objects. So it's definitely better to do it using NSData and writeToFile:atomically:, rather than coercing to a string and saving that from AppleScript. And the fact that it's done atomically makes it a bit safer. Depending on what you're doing with the XML, you possibly don't need the pretty print option.

For parsing, using NSXMLParser is particularly good with large XML files, because it doesn't keep them all in memory.

--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>


 _______________________________________________
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


References: 
 >Re: XML script library? (From: Shane Stanley <email@hidden>)
 >Re: XML script library? (From: Shane Stanley <email@hidden>)
 >Re: XML script library? (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: launch command bug
  • Next by Date: Re: To Run or Not To Run. That is the Question.
  • Previous by thread: Re: XML script library?
  • Next by thread: Re: A small request wrt list best practices
  • Index(es):
    • Date
    • Thread