• 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: Encoding text file to write XML
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Encoding text file to write XML


  • Subject: Re: Encoding text file to write XML
  • From: Hagimeno <email@hidden>
  • Date: Sat, 31 Oct 2009 19:30:46 +0000 (GMT)

Hi Sander,

I used wrong term.
I would like to escape chars. But I found different link that say different chars that are reserved to XML.
As I know there are: <, >, & and % (4 chars).
There are additional that I must know?

Alex

--- Sab 31/10/09, email@hidden <email@hidden> ha scritto:

> Da: email@hidden <email@hidden>
> Oggetto: AppleScript-Users Digest, Vol 6, Issue 562
> A: email@hidden
> Data: Sabato 31 ottobre 2009, 20:03
> Send AppleScript-Users mailing list
> submissions to
>     email@hidden
>
> To subscribe or unsubscribe via the World Wide Web, visit
>     http://lists.apple.com/mailman/listinfo/applescript-users
> or, via email, send a message with subject or body 'help'
> to
>     email@hidden
>
> You can reach the person managing the list at
>     email@hidden
>
> When replying, please edit your Subject line so it is more
> specific
> than "Re: Contents of AppleScript-Users digest..."
>
>
> Today's Topics:
>
>    1. Re: Unzip multiple items
> Applescript-terminal syntax help!
>       (Cerciello)
>    2. Re: Resolving an alias (Emmanuel
> LEVY)
>    3. getting the file icon (John Mitchell)
>    4. Re: Resolving an alias (Roger Howard)
>    5. Re: Resolving an alias (Roger Howard)
>    6. Encoding text file to write XML
> (Hagimeno)
>    7. Re: Encoding text file to write XML
> (Sander Tekelenburg)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 30 Oct 2009 20:46:37 +0100
> From: Cerciello <email@hidden>
> Subject: Re: Unzip multiple items Applescript-terminal
> syntax help!
> To: asu <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=iso-8859-1;
> format=flowed; delsp=yes
>
> Well Alex,I don't know the provenance of the zipped files
> as most of 
> the time are downloads from the net which usually are " rar
> " files 
> all cut in hundreds of small zipped files.
>
> But I also do archive my finished music production work
> which consists 
> of hundreds of audio files ".aiff". I tried already to
> unzip one of 
> those archive and was fine. However, it was zipped with
> Leopard 10.5 
> and as I just switched to Snow 10.6, I don't know yet the
> outcome of 
> my next archive . . time will tell :-)
>
> Mark thanx for the new revamped lines but unfortunately
> doesn't work.
>
> Best wishes
> gC
>
>
> On Oct 30, 2009, at 3:25 PM, Axel Luttgens wrote:
>
> > Le 29 oct. 2009 à 20:34, Cerciello a écrit :
> >
> >> [...]
> >> and back to the other question Axel, yes the
> integrity of the files 
> >> and folders appear to be correct as they have
> icons and works fine. 
> >> The only exeption are for the aliases which are
> not resolved. 
> >> However symlinks are fine. Any idea why?
> >
> > That's because traditionally, alias files had all
> relevant info 
> > stored in their resource fork. [1]
> > For example, with an alias created on a Tiger box, I
> have here:
> >
> >     luttgens$ ls -al somealias
> somealias/..namedfork/rsrc
> >     -rw-r--r--@ 1 luttgens 
> luttgens      0 30 oct 13:21 somealias
> >     -rw-r--r--  1 luttgens 
> luttgens  43629 30 oct 13:21 
> > somealias/..namedfork/rsrc
> >
> > Let's now suppose one has a zip archive of that file,
> somealias.zip.
> > When uncompressed with the help of unzip, one ends
> with two parts:
> >
> >     luttgens$ ls -al somealias
> __MACOSX/._somealias
> >     -rwxrwxrwx  1 luttgens 
> luttgens  43711 30 oct 14:44 
> > __MACOSX/._somealias
> >     -rwxrwxrwx@ 1 luttgens 
> luttgens      0 30 oct 14:44 somealias
> >
> > That is, all info now resides in a separate file,
> ._somealias. [2]
> > The one that unfortunately gets deleted with the
> removal of the 
> > __MACOSX folder...
> >
> > This kind of problem may occur not only for resource
> forks, but for 
> > various pieces of metadata as well.
> >
> > This is why I asked about the provenance of the zipped
> files.
> > If they have been created on some Mac OS X box,
> perhaps a command-
> > line tool such as "ditto" might prove more
> appropriate.
> >
> >
> > HTH,
> > Axel
> >
> >
> > [1] "Traditionally" because it seems that Snow Leopard
> creates 
> > aliases with data in both forks. I guess that this may
> be related to 
> > the new bookmark mechanism.
> > [2] By making use of a tool such as
> FixupResourceForks, it is 
> > possible to combine both parts back into a single
> file. 
> > _______________________________________________
> > Do not post admin requests to the list. They will be
> ignored.
> > AppleScript-Users mailing list     
> (applescript-
> > email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> > Archives: http://lists.apple.com/archives/applescript-users
> >
> > This email sent to email@hidden
>
>
>
> ------------------------------
>
> Message: 2
> Date: Fri, 30 Oct 2009 20:51:35 +0100
> From: Emmanuel LEVY <email@hidden>
> Subject: Re: Resolving an alias
> To: Applescript Users <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; format=flowed;
> delsp=yes
>
>
> On Oct 30, 2009, at 5:53 PM, Luther Fuller wrote:
> >> We think it's better to work with posix paths
> rather than the 
> >> native mac types for files.
> >>
> >> (For those interested, the strong reason is that
> alias fails at 
> >> making the difference between two mounted volumes
> or two shared 
> >> volumes with the same name).
> >
> > Mmmmm. I wondered. I was sure that aliases COULD
> distinguish between 
> > two volumes with the same name. An experiment is in
> order. Here's 
> > the script ...
> >
> > on run
> >     set test1 to alias
> "Work_Files:test-1.sparsebundle" -- disk name = 
> > "testDisk"
>
> Yes. As long as they exist, aliases are very knowledgeable.
> But how do 
> you make one from scratch? The problem is not the aliases
> to the 
> volumes, but the aliases to the files in those volumes.
>
> My example. I've got two volumes apparently named "Library"
> mounted. 
> (I say apparently because for unix one of them is
> "Library-1"). I can 
> make aliases to them which work. Now I want to access
> /Volumes/
> Library-1/somefile. If I had to use aliases, I would have
> to ask to 
> some app (such as Finder) to provide me with an alias for
> the file 
> named "somefile" in the alias-which-works: that's a call to
> an app for 
> each path you need. Whereas with posix paths, providing a
> path for my 
> file is just a string concatenation.
>
> The point is, you won't build an alias to my file
> with 
> "blah:blah:blah:blah" as alias. You'll have to use posix
> paths as some 
> step - so, why not using them for good.
>
> Emmanuel
>
>
> ------------------------------
>
> Message: 3
> Date: Sat, 31 Oct 2009 08:24:54 +1100
> From: John Mitchell <email@hidden>
> Subject: getting the file icon
> To: email@hidden
> Message-ID: <p06240800c7110933f377@[10.1.1.23]>
> Content-Type: text/plain; charset="us-ascii"
>
> many years ago in OS9 I could get the icon of a file as a
> picture but
> then in OSX could not.
> This used to work
> tell application "Finder"
>     choose file
>     -->    alias
> "mitchX:..:ACS_teamwork_2001"
>     get icon of alias
> "mitchX:...:ACS_teamwork_2001"
>     -->    missing value
> end tell
>
> is there a solution (I'm on 10.5.8)
>
> I'm using it to identify a document record in FMPro
>
> tia
> --
>
> -------------------------------------------------
> 1005/2 Dind Street, Milsons Point, NSW 2061 Australia
> tel: +61 (2) 9922 3785  fax: +61 (2) 9929 4035
> email:email@hidden
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.apple.com/mailman/private/applescript-users/attachments/20091031/4f9d8d0b/attachment.html
>
> ------------------------------
>
> Message: 4
> Date: Fri, 30 Oct 2009 16:19:18 -0700
> From: Roger Howard <email@hidden>
> Subject: Re: Resolving an alias
> To: Thomas Fischer <email@hidden>
> Cc: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="us-ascii"
>
> Forgive me if I'm misunderstanding the point, but coercing
> an alias to 
> a string and checking it's last character should be a
> pretty quick and 
> painless way to determine if the target of an alias is a
> directory 
> (ends with ":") or not, no?
>
>
> isDirectory(choose folder)
> (* returns true *)
>
> isDirectory(choose file)
> (* returns false *)
>
> on isDirectory(thisAlias)
>     return (last character of (thisAlias as
> string)) is ":"
> end isDirectory
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.apple.com/mailman/private/applescript-users/attachments/20091030/5909cfde/attachment.html
>
> ------------------------------
>
> Message: 5
> Date: Fri, 30 Oct 2009 16:29:12 -0700
> From: Roger Howard <email@hidden>
> Subject: Re: Resolving an alias
> To: Emmanuel LEVY <email@hidden>
> Cc: Applescript Users <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii; format=flowed;
> delsp=yes
>
>
> On Oct 30, 2009, at 9:12 AM, Emmanuel LEVY wrote:
>
> > We think it's better to work with posix paths rather
> than the native 
> > mac types for files.
>
> Working with paths vs. aliases (and file specs) is really a
> matter of 
> purpose. I use aliases where I'm wanting to refer to a
> specific file 
> that may be at risk of the user moving/renaming it, such as
> during a 
> drag/drop-initiated process, where the user is already
> interacting the 
> with the file in their file manager.
>
> I work with paths where it's convenient - for instance, I
> often write 
> wrappers around command line tools, where paths make sense;
> or when I 
> want to reference a fixed location, and do *not* want the
> intelligence 
> of aliases complicating things.
>
> Different mechanisms for different needs,
>
> Roger
>
>
> ------------------------------
>
> Message: 6
> Date: Sat, 31 Oct 2009 15:14:16 +0000 (GMT)
> From: Hagimeno <email@hidden>
> Subject: Encoding text file to write XML
> To: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=utf-8
>
> Hi all,
> We need to generate a XML file with data that contains
> private chars like >.
> What's the best method to write XML file using AppleScript
> (without to use 3rd parts scripting additions) and
> automatically convert reserver chars?
>
> Alex
>
>
>      
>
>
> ------------------------------
>
> Message: 7
> Date: Sat, 31 Oct 2009 17:13:12 +0100
> From: Sander Tekelenburg <email@hidden>
> Subject: Re: Encoding text file to write XML
> To: email@hidden
> Message-ID: <p06240648c712104bd7bc@[192.168.0.101]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> At 15:14 +0000 UTC, on 2009-10-31, Hagimeno wrote:
>
> > Hi all,
> We need to generate a XML file with data that contains
> private
> >chars like >.
> What's the best method to write XML file using AppleScript
> >(without to use 3rd parts scripting additions) and
> automatically convert
> >reserver chars?
>
> Something about your message's encoding seems messed up, so
> I'm not sure I
> see the caracters you intended to be seen. Might be 'just'
> broken line
> endings though.
>
> If you're talking about the ">" character -- this has
> nothing to do with
> encoding. It's a reserved character in XML, so you'll need
> to escape it if
> you want to use it as a 'regular' character. How to do that
> is specific to
> XML, nothing to do with AppleScript -- look it up in the
> XML spec.
>
> If I misunderstood, and you really are talking about
> encoding and
> transliteration:
> One doesn't just "convert", but converts "from, to". So
> your script needs to
> know the input text's character repertoire, and
> transliterate that to an
> appropriate character repertoire for output -- that is,
> assuming that the
> input's character repertoire isn't appropriate for output
> in the first
> place...
>
> Vanilla AS can read and write text as MacRoman, utf-8 and
> utf-16 (and
> latin-1, I think -- not sure). If the character repertoire
> of the input text
> is something else, you'll probably need to first
> transliterate it to one of
> those, which is possible with cli tools (installed by
> default), through do
> shell script.
>
> Without knowing details of what you need to be able to do
> with the XML file,
> utf-8 is probably a good choice to write to:
>
>   write to myXMLfile as «class utf8»
>
>
> --
> Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>
>
>
> ------------------------------
>
> _______________________________________________
> AppleScript-Users mailing list
> email@hidden
> http://lists.apple.com/mailman/listinfo/applescript-users
>
> End of AppleScript-Users Digest, Vol 6, Issue 562
> *************************************************
>



 _______________________________________________
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

  • Prev by Date: Re: Encoding text file to write XML
  • Next by Date: can't make {to recipient} from {get recipient of theMessage}
  • Previous by thread: Re: Encoding text file to write XML
  • Next by thread: can't make {to recipient} from {get recipient of theMessage}
  • Index(es):
    • Date
    • Thread