Add tags

Add tags to the following comment
全部パーズしてからsxpathで取り出すので効率は悪いです。 sxpathは一致するノード全てのリストを返すんで、最初のノードの内容だけmatch節で取り出してますが、お題ではそのへんがちょっと不明確? (lastBuildDataは必ずひとつなのか、とか) Gaucheの内部エンコーディングがutf-8でない場合は*data*のエンコーディングを変換しといてください。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
(use sxml.ssax)
(use sxml.sxpath)
(use rfc.http)
(use util.match)

(define *data* (values-ref (http-get "ja.doukaku.org" "/feeds/comments") 2))

(define (extract)
  (match ((sxpath '(// lastBuildDate))
          (call-with-input-string *data* (cut ssax:xml->sxml <> '())))
    [(('lastBuildDate content) . _) content]
    [else #f]))

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...