xml_set_objectとは? わかりやすく解説

Weblio 辞書 > コンピュータ > PHP関数リファレンス > xml_set_objectの意味・解説 

xml_set_object

(PHP 4, PHP 5)
xml_set_object — オブジェクト内部で XML パーサを使用する

説明

bool xml_set_object ( resource parser, object &object )
この関数は、object の内部から parser を使用可能にします。 xml_set_element_handler() 等により設定される 全てのコールバック関数は、object のメソッドであると仮定されます。
例 2462. xml_set_object() の例
<?php
class xml  {
   var $parser;

   function xml()
   {
       $this->parser = xml_parser_create();

       xml_set_object($this->parser, $this);
       xml_set_element_handler($this->parser, "tag_open", "tag_close");
       xml_set_character_data_handler($this->parser, "cdata");
   }

   function parse($data)
   {
       xml_parse($this->parser, $data);
   }

   function tag_open($parser, $tag, $attributes)
   {
       var_dump($parser, $tag, $attributes);
   }

   function cdata($parser, $cdata)
   {
       var_dump($parser, $cdata);
   }

   function tag_close($parser, $tag)
   {
       var_dump($parser, $tag);
   }

} // class xml ここまで

$xml_parser = new xml();
$xml_parser->parse("<A ID='hallo'>PHP</A>");
?>





英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「xml_set_object」の関連用語

xml_set_objectのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



xml_set_objectのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
PHP Documentation GroupPHP Documentation Group
Copyright © 1997 - 2024 by the PHP Documentation Group.

©2024 GRAS Group, Inc.RSS