Hatena::Grouprubyist

今日も元気にrubyist

2007-05-30

今日の成果-コメントの子要素まで表示する 19:26 今日の成果-コメントの子要素まで表示する - 今日も元気にrubyist を含むブックマーク はてなブックマーク - 今日の成果-コメントの子要素まで表示する - 今日も元気にrubyist 今日の成果-コメントの子要素まで表示する - 今日も元気にrubyist のブックマークコメント


require 'kconv'
require 'rexml/document'
include REXML

doc = REXML::Document.new File.open("newsing.xml","r")

doc.root.each_element do |elem|
  puts "====================★ENTRY★===================="
  elem.each_element do |elem|
    puts elem.text.tosjis if elem.has_text? && elem.name != "comments"
    if elem.name == "comments"
    puts "-----コメント-----"
      elem.each_element do |elem|
        elem.each_element do |elem|
          puts elem.text.tosjis if elem.has_text?
        end
      end
    end
  end
end

もうちょい上手い方法がありそうだけど、以前のロジックより全然文量が少ない!

前はtextファイルデータ書き出して1行づつ配列化してたからなぁ…。

取りあえず今日はここまで。

DennisedispDennisedisp2017/03/29 14:23flagyl bijwerkingen hond
<a href= http://masonducay.over-blog.com/2017/03/zovirax.html >zovirax creme tijdens zwangerschap</a>
<a href=http://masonducay.over-blog.com/2017/03/zovirax.html>zovirax cream baby</a>
zovirax oogzalf aciclovir
<a href= http://lonsibounm.eklablog.net >overdosis propranolol dodelijk</a>
<a href=http://masonducay.over-blog.com/2017/03/zovirax.html>zovirax creme 2g prix</a>
propranolol en angststoornissen

WilliamfenWilliamfen2017/03/31 16:57aknemycin plus lösung erfahrungsberichte
<a href= http://bobbicraws.site123.me/about >resochin 250</a>
<a href=https://agnusdinap.yolasite.com>nifurantin und pille</a>
azithromycin 500 n2
<a href= http://bobbicraws.site123.me/about >resochin malaria tropica</a>
<a href=https://benitocape.jimdo.com>aknemycin lösung</a>
nifurantin b6 nebenwirkungen

ReubenhopReubenhop2017/04/02 22:29augmentin serve gastroprotettore
<a href= http://www.onweb.fr?company_id=17318 >pilula qlaira engorda</a>
<a href=http://www.onweb.fr?company_id=17318>qlaira preço panvel</a>
diclofenaco potássico gotas
<a href= http://janethorua.guildomatic.com >augmentin 500mg/62 5 mg</a>
<a href=http://laureneasu.tribalpages.com>diclofenaco pomada na gravidez</a>
albendazol dose unica posologia

MatthewDakMatthewDak2017/04/07 14:15amoxicilline sandoz 1g
<a href= http://sydneyvoll.webblogg.se >tolexine gé 100 avis</a>
<a href=http://salomemahe.page4.me>finasteride generique biogaran</a>
prix doxyval 250 mg
<a href= http://gitabeursk.site123.me/about >dermipred 10 posologie chat</a>
<a href=http://sydneyvoll.webblogg.se>tolexine 100 mg</a>
dermipred 10 20

JamesvorJamesvor2017/04/10 15:43zovirax compresse posologia
<a href= http://kirkagrest.myfreesites.net >etoricoxib generico prezzo</a>
<a href=http://karlbiasot.yolasite.com>janumet 50mg/1000mg</a>
amoxicillina generico prezzo
<a href= http://www.onweb.fr?company_id=17319 >amoxicillina generico di</a>
<a href=http://www.luciocapsh-87.webself.net>sandoz-celecoxib 200 mg</a>
etoricoxib nombre generico

unxuxuhudevounxuxuhudevo2017/06/10 18:20http://100mgcheapest-price-viagra.com/ - 100mgcheapest-price-viagra.com.ankor <a href="http://tadalafil-buy-5mg.com/">tadalafil-buy-5mg.com.ankor</a> http://20mgprednisone-order.com/

ixeyupireixeyupire2017/06/10 18:27http://100mgcheapest-price-viagra.com/ - 100mgcheapest-price-viagra.com.ankor <a href="http://tadalafil-buy-5mg.com/">tadalafil-buy-5mg.com.ankor</a> http://20mgprednisone-order.com/

ehuwuwbiziehuwuwbizi2017/06/10 18:36http://100mgcheapest-price-viagra.com/ - 100mgcheapest-price-viagra.com.ankor <a href="http://tadalafil-buy-5mg.com/">tadalafil-buy-5mg.com.ankor</a> http://20mgprednisone-order.com/

eqibiceufiroeqibiceufiro2017/06/10 18:43http://100mgcheapest-price-viagra.com/ - 100mgcheapest-price-viagra.com.ankor <a href="http://tadalafil-buy-5mg.com/">tadalafil-buy-5mg.com.ankor</a> http://20mgprednisone-order.com/

owiroosgivowiroosgiv2017/06/10 19:06http://100mgcheapest-price-viagra.com/ - 100mgcheapest-price-viagra.com.ankor <a href="http://tadalafil-buy-5mg.com/">tadalafil-buy-5mg.com.ankor</a> http://20mgprednisone-order.com/

ebayofadojebayofadoj2017/06/10 19:39http://100mgcheapest-price-viagra.com/ - 100mgcheapest-price-viagra.com.ankor <a href="http://tadalafil-buy-5mg.com/">tadalafil-buy-5mg.com.ankor</a> http://20mgprednisone-order.com/

acicacwacicacw2017/06/13 11:04http://100mgcheapest-price-viagra.com/ - 100mgcheapest-price-viagra.com.ankor <a href="http://tadalafil-buy-5mg.com/">tadalafil-buy-5mg.com.ankor</a> http://20mgprednisone-order.com/

ooviwoyeisuvooviwoyeisuv2017/07/20 20:46http://100mg-viagracanada.com/ - 100mg-viagracanada.com.ankor <a href="http://sertralinezoloftonline.com/">sertralinezoloftonline.com.ankor</a> http://20mg-tadalafil-lowest-price.com/

axactoweaxactowe2017/07/20 21:00http://100mg-viagracanada.com/ - 100mg-viagracanada.com.ankor <a href="http://sertralinezoloftonline.com/">sertralinezoloftonline.com.ankor</a> http://20mg-tadalafil-lowest-price.com/

asewahaasewaha2017/07/20 21:01http://100mg-viagracanada.com/ - 100mg-viagracanada.com.ankor <a href="http://sertralinezoloftonline.com/">sertralinezoloftonline.com.ankor</a> http://20mg-tadalafil-lowest-price.com/

eplopuyuweplopuyuw2017/07/20 21:04http://100mg-viagracanada.com/ - 100mg-viagracanada.com.ankor <a href="http://sertralinezoloftonline.com/">sertralinezoloftonline.com.ankor</a> http://20mg-tadalafil-lowest-price.com/

biriqobivedabiriqobiveda2017/07/20 21:17http://100mg-viagracanada.com/ - 100mg-viagracanada.com.ankor <a href="http://sertralinezoloftonline.com/">sertralinezoloftonline.com.ankor</a> http://20mg-tadalafil-lowest-price.com/

uhejawouhejawo2017/07/20 21:19http://100mg-viagracanada.com/ - 100mg-viagracanada.com.ankor <a href="http://sertralinezoloftonline.com/">sertralinezoloftonline.com.ankor</a> http://20mg-tadalafil-lowest-price.com/

aerolfveneaaerolfvenea2017/07/23 21:09http://20mg-cheapesttadalafil.com/ - 20mg-cheapesttadalafil.com.ankor <a href="http://20mg-cheapesttadalafil.com/">20mg-cheapesttadalafil.com.ankor</a> http://20mg-cheapesttadalafil.com/

ogdadudoogdadudo2017/08/11 14:08http://20mg-cheapesttadalafil.com/ - 20mg-cheapesttadalafil.com.ankor <a href="http://20mg-cheapesttadalafil.com/">20mg-cheapesttadalafil.com.ankor</a> http://20mg-cheapesttadalafil.com/

ehoqodsigohatehoqodsigohat2017/08/11 14:08http://20mg-cheapesttadalafil.com/ - 20mg-cheapesttadalafil.com.ankor <a href="http://20mg-cheapesttadalafil.com/">20mg-cheapesttadalafil.com.ankor</a> http://20mg-cheapesttadalafil.com/

eriyinaokoheriyinaokoh2017/08/11 14:16http://20mg-cheapesttadalafil.com/ - 20mg-cheapesttadalafil.com.ankor <a href="http://20mg-cheapesttadalafil.com/">20mg-cheapesttadalafil.com.ankor</a> http://20mg-cheapesttadalafil.com/

uqedabibokueuqedabibokue2017/08/11 14:20http://20mg-cheapesttadalafil.com/ - 20mg-cheapesttadalafil.com.ankor <a href="http://20mg-cheapesttadalafil.com/">20mg-cheapesttadalafil.com.ankor</a> http://20mg-cheapesttadalafil.com/

effivomiweffivomiw2017/08/11 14:22http://20mg-cheapesttadalafil.com/ - 20mg-cheapesttadalafil.com.ankor <a href="http://20mg-cheapesttadalafil.com/">20mg-cheapesttadalafil.com.ankor</a> http://20mg-cheapesttadalafil.com/

ibixqupagaibixqupaga2017/08/11 14:29http://20mg-cheapesttadalafil.com/ - 20mg-cheapesttadalafil.com.ankor <a href="http://20mg-cheapesttadalafil.com/">20mg-cheapesttadalafil.com.ankor</a> http://20mg-cheapesttadalafil.com/

eteyikeeteyike2017/08/12 11:16http://20mg-cheapesttadalafil.com/ - 20mg-cheapesttadalafil.com.ankor <a href="http://20mg-cheapesttadalafil.com/">20mg-cheapesttadalafil.com.ankor</a> http://20mg-cheapesttadalafil.com/

isawahawoxofisawahawoxof2017/08/12 11:29http://20mg-cheapesttadalafil.com/ - 20mg-cheapesttadalafil.com.ankor <a href="http://20mg-cheapesttadalafil.com/">20mg-cheapesttadalafil.com.ankor</a> http://20mg-cheapesttadalafil.com/