From owner-FreeBSD-users-jp@jp.FreeBSD.org Mon Feb 16 09:49:50 2009
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) id n1G0nof26116;
	Mon, 16 Feb 2009 09:49:50 +0900 (JST)
	(envelope-from owner-FreeBSD-users-jp@jp.FreeBSD.org)
Received: from mail.maizuru-ct.ac.jp (mail.maizuru-ct.ac.jp [202.19.105.130])
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) with ESMTP/inet id n1G0nnq26111
	for <FreeBSD-users-jp@jp.FreeBSD.org>; Mon, 16 Feb 2009 09:49:49 +0900 (JST)
	(envelope-from magara@maizuru-ct.ac.jp)
Received: from ns1.maizuru-ct.ac.jp (ns1 [10.1.16.3])
	by mail.maizuru-ct.ac.jp (Postfix) with ESMTP id 4C2581C022C
	for <FreeBSD-users-jp@jp.FreeBSD.org>; Mon, 16 Feb 2009 09:49:49 +0900 (JST)
Received: from s-gikan2.maizuru-ct.ac.jp (s-gikan2.maizuru-ct.ac.jp [10.1.65.80])
	by ns1.maizuru-ct.ac.jp (Postfix) with SMTP id 4315B107E73
	for <FreeBSD-users-jp@jp.FreeBSD.org>; Mon, 16 Feb 2009 09:49:49 +0900 (JST)
Received: (qmail 41610 invoked from network); 16 Feb 2009 00:49:49 -0000
Received: from unknown (HELO magaram) (10.1.65.81)
  by s-gikan2.maizuru-ct.ac.jp with SMTP; 16 Feb 2009 00:49:49 -0000
To: FreeBSD-users-jp@jp.FreeBSD.org
From: "K.Magara" <magara@maizuru-ct.ac.jp>
References: <200902131222.CFD82863.BHBBSN@maizuru-ct.ac.jp>
	<200902130527.AA00946@POLYMER5.scphys.kyoto-u.ac.jp>
	<200902131500.IFF69712.NBHBBS@maizuru-ct.ac.jp>
	<86tz6xspxp.wl%maya@negeta.com>
In-Reply-To: <86tz6xspxp.wl%maya@negeta.com>
Message-Id: <200902160949.CBG82398.SNHBBB@maizuru-ct.ac.jp>
X-Mailer: Winbiff [Version 2.51 PL2]
X-Accept-Language: ja,en,zh
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-2022-jp
Reply-To: FreeBSD-users-jp@jp.FreeBSD.org
Precedence: list
Date: Mon, 16 Feb 2009 09:49:34 +0900
X-Sequence: FreeBSD-users-jp 92079
Subject: [FreeBSD-users-jp 92079] Re: PHP  =?ISO-2022-JP?B?GyRCJEgbKEI=?=
 libxml2 =?ISO-2022-JP?B?GyRCJE40WDc4GyhC?= 
Sender: owner-FreeBSD-users-jp@jp.FreeBSD.org
X-Originator: magara@maizuru-ct.ac.jp
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+060209

$BbCJA$G$9(B

   "[FreeBSD-users-jp 92076] Re: PHP  $B$H(Blibxml2 $B$N4X78(B " $B$K$*$$$F!"(B
   "maya <maya@negeta.com>"$B$5$s$O=q$-$^$7$?!'(B

>maya $B$G$9!#(B

$B$*JV;v$"$j$,$H$&$4$6$$$^$9!#(B
## [FreeBSD-users-jp 92073] $B$G$O!V$5$s!W$,H4$1$F$*$j(B
## $BBgJQ<:Ni$7$^$7$?!#(B


>> $B4N?4$N!X%3!<%9$N%j%9%H%"$G(BHTML$B%?%0$N(B"<"$B$H(B">"$B$,<h$l$k$H$$$&%P%0!Y(B
>> XMLparser$BMm$_$N%P%0$,D>$C$F$$$^$;$s$G$7$?(B orz
>> $B#O#S$N:F5/F0!"%V%i%&%6$N%-%c%C%7%e:o=|$b;n$7$^$7$?$,#N#G$G$9!#(B
>
>http://bugs.php.net/bug.php?id=45996
>$B$K$D$$$F$$$?(B
>https://qa.mandriva.com/attachment.cgi?id=1075
>$B$G$O$I$&$J$j$^$9$+!)(B

https://qa.mandriva.com/attachment.cgi?id=10757
$B$G$9$M!#(B
## 1075 $B$G$b%j%s%/$,$"$j$^$7$?$,!"0UL#ITL@$G%"%;%j$^$7$?(B(^^;)

>$B$&$A$O(B libxml $B$r(B ports $B$G!"(BPHP $B$r<+J,$G%3%s%Q%$%k$7$F$$$^$9$,!"(B
>$B$3$N%F%9%HMQ%3!<%I$O0U?^$7$?$H$*$jF0$$$F$$$^$9!#(B

% php test.php
foo
wibble
/foo

$B;DG0$J$,$i(B Expected result $B$K$O$J$j$^$;$s$G$7$?!#(B

## #!/usr/local/bin/php $B$G!"<B9T8"8BIU$1$F(B
## ./test.php $B$G$bF1$8!JEv$?$jA0$G$9$,!K(B

$B62$lF~$j$^$9$,!"0z$-B3$->pJs$r$*4j$$$$$?$7$^$9!#(B


<<<$B$3$3$+$i(B>>>
#!/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

*/
<<<$B$3$3$^$G(B>>>
