眞柄です

   "[FreeBSD-users-jp 92076] Re: PHP  とlibxml2 の関係 " において、
   "maya <m...@negeta.com>"さんは書きました:

>maya です。

お返事ありがとうございます。
## [FreeBSD-users-jp 92073] では「さん」が抜けており
## 大変失礼しました。


>> 肝心の『コースのリストアでHTMLタグの"<"と">"が取れるというバグ』
>> XMLparser絡みのバグが直っていませんでした orz
>> OSの再起動、ブラウザのキャッシュ削除も試しましたがNGです。
>
>http://bugs.php.net/bug.php?id=45996
>についていた
>https://qa.mandriva.com/attachment.cgi?id=1075
>ではどうなりますか?

https://qa.mandriva.com/attachment.cgi?id=10757
ですね。
## 1075 でもリンクがありましたが、意味不明でアセリました(^^;)

>うちは libxml を ports で、PHP を自分でコンパイルしていますが、
>このテスト用コードは意図したとおり動いています。

% php test.php
foo
wibble
/foo

残念ながら Expected result にはなりませんでした。

## #!/usr/local/bin/php で、実行権限付けて
## ./test.php でも同じ(当たり前ですが)

恐れ入りますが、引き続き情報をお願いいたします。


<<<ここから>>>
#!/usr/bin/env php
<?php

class Parser
{
        private $mParser;

        public function Parse($xml, $encoding = 'UTF-8')
        {
                $this->mParser = xml_parser_create($encoding);

                xml_parser_set_option($this->mParser, XML_OPTION_CASE_FOLDING, 
0);
                xml_parser_set_option($this->mParser, 
XML_OPTION_TARGET_ENCODING, $encoding);
                xml_set_object($this->mParser, $this);

                // Set the element handlers for the parser.
                xml_set_element_handler($this->mParser, 
'start_element','end_element');
                xml_set_character_data_handler($this->mParser,'character_data');
                return xml_parse($this->mParser, $xml, true);
        }

        public function start_element($parser, $name, $attrs)
        {
                // Noop
        }

        public function end_element($parser, $name)
        {
                // Noop
        }

        public function character_data($parser, $data)
        {
                echo $data."\n";
        }
}

$parser = new Parser;
$parser->Parse('<xml>&lt;foo&gt;wibble&lt;/foo&gt;</xml>');


/*
Expected results:

$ php test.php
<
foo
>
wibble
<
/foo
>


Actual results:
$ php test.php
foo
wibble
/foo

*/
<<<ここまで>>>

メールによる返信