2007-01-12 19:11:30

CatalystでXML出力

[ Catalyst ] [ XML ]

[Catalyst::View::REST::XML]
$c->response->headers->content_type('text/xml');
$c->response->output( XMLout $c->stash, RootName => 'response' );

[Catalyst::View::Atom::XML]
$c->response->content_type('application/atom+xml');
$c->response->body($obj->as_xml);

Viewを自作してもよし。
Catalyst::Response はShortcut、Aliasが多くて、混乱しやすい。

2007-01-04 11:22:39

XMLのMIME型

[ XML ] [ Apache ]

ATOMは
RFC4287 http://www.ietf.org/rfc/rfc4287
(日本語訳 http://www.futomi.com/lecture/japanese/rfc4287.html)

application/atom+xml
なので、httpd.confに
AddType application/atom+xml .xml

XSLはとりあえず
application/xml

httpd.confに
AddType application/xml .xsl
とした。

2007-01-04 10:57:01

XSLでの整形

[ XML ]

よく使うもの。

<xsl:value-of select="." disable-output-escaping="yes"/>
[xsl:value-of]
ノードの文字列値を出力する。
要素ノードの文字列値はすべての子孫テキストノードの文字列値をドキュメント順に連結したものとなる。
[disable-output-escaping="yes"]
文字参照を実体化して出力する

<xsl:copy-of select="."/>
[xsl:copy-of]
ノードを文字列値を出力する。
要素を全ての子孫要素を含めて、そのまま出力
XHTMLを出力する場合はこっち

2007-01-02 20:18:52

Atom

[ XML ]

Atom がよくわからない。
RSS より拡張性がある(More XML?)とのことなのだが・・・。
今のところ、RSS より拡張性があるようには感じられない。

でも今さらRSSってのも嫌だ。

[The Atom Syndication Format]
http://www.futomi.com/lecture/japanese/rfc4287.html