좋아요, 작업 속도를 Libxml-ruby로 바꾸려면 _why가 사라지고 속도가 빠르므로 Nokogiri를 잠깐 보았지만 속도와 수명을 위해 Libxml-ruby를 살펴보기로했습니다. 나는 기본적인 뭔가를 놓친하지만 작동하지 않는 일을하려고 메신저, 여기 내 XML 문자열입니다해야합니다 전체 피드에서 약 150 같은 항목이libxml-ruby 구문 분석 도움말
<?xml version="1.0" encoding="utf-8" ?>
<feed>
<title type="xhtml"></title>
<entry xmlns="http://www.w3.org/2005/Atom">
<id>urn:publicid:xx.xxx:xxxxxx</id>
<title>US--xxx-xxxxx</title>
<updated>2009-08-19T15:49:51.103Z</updated>
<published>2009-08-19T15:44:48Z</published>
<author>
<name>XX</name>
</author>
<rights>blehh</rights>
<content type="text/xml">
<nitf>
<head>
<docdata>
<doc-id regsrc="XX" />
<date.issue norm="20090819T154448Z" />
<ed-msg info="Eds:" />
<doc.rights owner="xx" agent="hxx" type="none" />
<doc.copyright holder="xx" year="2009" />
</docdata>
</head>
<body>
<body.head>
<hedline>
<hl1 id="headline">headline</hl1>
<hl2 id="originalHeadline">blah blah</hl2>
</hedline>
<byline>john doe<byttl>staffer</byttl></byline>
<distributor>xyz</distributor>
<dateline>
<location>foo</location>
</dateline>
</body.head>
<body.content>
<block id="Main">
story content here
</block>
</body.content>
<body.end />
</body>
</nitf>
</content>
</entry>
</feed>
.
난 그냥 150 항목을 통해 루프를 누른 다음 내용과 특성을 잡아하지만 난 libxml - 루비와 시간이 지옥을 가지고있어 Hpricot와 잘 일했다.
parser = XML::Parser.string(file)
doc = parser.parse
entries = doc.find('//entry')
puts entries.size
entries.each do |node|
puts node.inspect
end
어떤 아이디어 :
이 작은 조각
메신저도 항목을받지 못하고 있음을 보여줍니다? 나는 문서를 살펴 보았고 여기서 XML 파일을 찾을 수 없었다. 여기 x, y, z를 가져 오는 샘플이있다. 이것은 아주 간단해야합니다.
나는이 스레드로 돌아 가기를 잊었지만, 나는 비슷한 것을했다. – initialized