3

libxml++ を使用してウィキメディアから xml ファイルを解析しています。textparser を使用してすべてのノードからスタックにテキストをプッシュできましたが、ページと /page の間のテキストを具体的に取得し、テキスト、著者名、およびタイトルを取得したいと考えています。libxml++ でこれを行う方法がわかりません。これはウィキメディアのページのサンプルです

<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.7/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.7/ http://www.mediawiki.org/xml/export-0.7.xsd" version="0.7" xml:lang="en">
  <page>
    <title>Human Anatomy/Osteology/Axialskeleton</title>
    <ns>0</ns>
    <id>181313</id>
    <revision>
      <id>1481605</id>
  <parentid>1379871</parentid>
  <timestamp>2009-04-26T02:03:12Z</timestamp>
  <contributor>
    <username>Adrignola</username>
    <id>169232</id>
  </contributor>
  <minor/>
  <comment>+Category</comment>
  <sha1>hvxozde19haz4yhwj73ez82tf2bocbz</sha1>
  <text xml:space="preserve">[[Image:Axial_skeleton_diagram.svg|thumb|240px|right|Diagram of the axial skeleton]]

The Axial Skeleton is a division of the human skeleton and is named because it makes up the longitudinal ''axis'' of the body. It consists of the skull, hyoid bone, vertebral column, sternum and ribs. It is widely accepted to be made up of 80 bones, although this number varies from individual to individual.

[[Category:{{FULLBOOKNAME}}|{{FULLCHAPTERNAME}}]]</text>
</revision>

テキスト、作成者、日付などのノードを文字列または Glib::ustring として保存するにはどうすればよいですか? xpath を利用してみました。これは宿題ではありません。

-gtk

4

0 に答える 0