• 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 generation details (was Re: ASObjC alloc and object creation)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XML generation details (was Re: ASObjC alloc and object creation)


  • Subject: Re: XML generation details (was Re: ASObjC alloc and object creation)
  • From: Jean-Christophe Helary <email@hidden>
  • Date: Tue, 30 Jan 2018 10:25:15 +0900

Cold morning up here in Japan, but it's heart warming to see your mail from
scorching hot Australia in my inbox :) Thank you !

>> So that "+" between the two options is the bit-OR thing?
>
> Right. Bit-OR-ing means if one OR other value's particular bit is true, the
> bit for that result is true -- so 0001 and 010 gives 0011. That's the same as
> 1 + 2 = 3 in the integer world.

Theoretical question: 1 + 5 = 2 + 4 so how does the system know I want options
1 and 5 instead of options 2 and 4 ? Or maybe I'm not talking about the same
thing ?

>> Also, when I click on the "Constants" link I don't find NSXMLDocumentTidyXML
>> nor NSXMLNodePrettyPrint but they *are* in the doc, under NSXMLNodeOptions,
>> which is confusing...
>
> Yes and no. You should be seeing this declaration:
>> - (NSData *)XMLDataWithOptions:(NSXMLNodeOptions)options;

Ooops, yes.

> That's telling you that the options are NSXMLNodeOptions, and in fact the
> word itself is a link to them. You will also see it if you use
> code-completion.
>
>> But in any case, what I get there is:
>>
>>     NSXMLDocumentTidyXML = 1UL << 10,
>>     NSXMLNodePrettyPrint = 1UL << 17,
>>
>> Which really doesn't mean much to me.
>
> But all you need to know is (a) what they are, and (b) that you add them as
> if they are integers (give or take a "get").

Fair enough.

Question: is there a *really* good book on Cocoa that would help understanding
all that with ASObjC in mind?

>> 2) writeToFile:atomically: is an NSString instance method and seems to be
>> deprecated.
>
> Right. Without specifying encoding it's potentially meaningless.

Ok. Side question: the XML document is already specified as UTF-8 with:

theProject's setCharacterEncoding:"UTF-8"

As far as I can tell, BBEdit opens the file properly in the encoding that's set
here (I also tested UTF-16). So is adding the encoding here just better (and
now compulsory) for documents that may not have an explicit encoding
declaration somewhere else?

>> But when I try writeToFile:atomically:encoding:error: instead, I fumble:
>>
>> theData's writeToFile:"/path/to/file" atomically:true encoding:(current
>> application's NSUTF8StringEncoding) |error|:NULL
>>
>> where SD seemingly complains about |error|...
>
> AppleScript's equivalent of NULL is missing value.

page 52 of your book... :)

Ok, the blog article I promised myself to write last spring about that XML
generation process is really getting closer to completion now. Hoping it will
be useful to other scripters...


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune


 _______________________________________________
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

  • Follow-Ups:
    • Re: XML generation details (was Re: ASObjC alloc and object creation)
      • From: Shane Stanley <email@hidden>
References: 
 >ASObjC alloc and object creation (From: Jean-Christophe Helary <email@hidden>)
 >Re: ASObjC alloc and object creation (From: Shane Stanley <email@hidden>)
 >Re: ASObjC alloc and object creation (From: Jean-Christophe Helary <email@hidden>)
 >Re: ASObjC alloc and object creation (From: Jean-Christophe Helary <email@hidden>)
 >Re: ASObjC alloc and object creation (From: Shane Stanley <email@hidden>)
 >Re: ASObjC alloc and object creation (From: Jean-Christophe Helary <email@hidden>)
 >XML generation details (was Re: ASObjC alloc and object creation) (From: Jean-Christophe Helary <email@hidden>)
 >Re: XML generation details (was Re: ASObjC alloc and object creation) (From: Jean-Christophe Helary <email@hidden>)
 >Re: XML generation details (was Re: ASObjC alloc and object creation) (From: Jean-Christophe Helary <email@hidden>)
 >Re: XML generation details (was Re: ASObjC alloc and object creation) (From: Shane Stanley <email@hidden>)
 >Re: XML generation details (was Re: ASObjC alloc and object creation) (From: Jean-Christophe Helary <email@hidden>)
 >Re: XML generation details (was Re: ASObjC alloc and object creation) (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: XML generation details (was Re: ASObjC alloc and object creation)
  • Next by Date: Re: XML generation details (was Re: ASObjC alloc and object creation)
  • Previous by thread: Re: XML generation details (was Re: ASObjC alloc and object creation)
  • Next by thread: Re: XML generation details (was Re: ASObjC alloc and object creation)
  • Index(es):
    • Date
    • Thread