Archive

Archive for 6月, 2009

カバーフローのライブラリ

6月 24th, 2009

coverflowを再現するオープンソースライブラリ

http://www.chaosinmotion.com/flowcover.m

kuni プログラム

<Error>: The executable was signed with invalid entitlements.

6月 23rd, 2009

App Storeで公開中のアプリのソースを受け取ってローカルでビルド、実機転送したときに
The executable was signed with invalid entitlements.
とエラーが発生して転送に失敗しました。

開発用プロファイルにもかかわらずCode Signing Entitlementsで指定されたplistの中のget-task-allowチェックボックスがオフになっていたのが原因でした。チェックボックスをオンにしたところ解決しました。

soda 未分類

libxml2でattributeを取りたい

6月 5th, 2009

saxパーサであるlibxml2でattributeの中身を出すのに苦労したので、ここに書きます。

xmlSAXHandlerの「startElementNsSAX2Func」部分に、読み出してくれる関数を設定し、
受け側関数部分は、
static void startElementSAX(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes)
の様に書きますが、一見、attributesをnb_attributesの数だけ出力すればすぐ出るんじゃないの?
と思いますが、そこを出しても、例えば

<rss version=”2.0″>

の様なタグがああった場合、「version」という部分しか出ないんですね..。

javaのlibxml2ばかり出てきてしまい、非常に時間がかかったのですが、いろいろ探しまわった結果、

http://blogs.dion.ne.jp/p50p100/archives/6751189.html

に書かれている事をする事で、ちゃんと「2.0」部分まで取れるようになりました。

修正したのは、受側関数部分のattributeの所を以下のように修正、
static void startElementSAX(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar *(*attributes)[5]) {

それで以下のように

for(int i=0;i  NSString *string = [NSString stringWithFormat:@"%s=\"%.*s\"" , attributes[i][0], attributes[i][4] – attributes[i][3], attributes[i][3] ];
 NSLog(string);
}

取得する事で、きちんと
「version=”2.0″」と取る事が出来ました。

引数の受け取り方自体を書き換え、文字列を切って表示するという方法?でしょうか。

kuni プログラム