#33240 [Opn]: XML_OPTION_SKIP_WHITE skips important spaces
| From: | jacob at jacobweber dot com | Date: | Fri, 03 Jun 2005 21:20:05 +0000 |
| Subject: | #33240 [Opn]: XML_OPTION_SKIP_WHITE skips important spaces | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969368420@lists.php.net to get a copy of this message | ||
ID: 33240
User updated by: jacob at jacobweber dot com
Reported By: jacob at jacobweber dot com
Status: Open
Bug Type: Documentation problem
Operating System: Fedora Core 3
PHP Version: Irrelevant
New Comment:
I noticed that, so maybe they're not meant to be used. But one of the
two examples I posted is incorrect: it should skip the space all the
time or never.
Previous Comments:
------------------------------------------------------------------------
[2005-06-03 23:13:42] sniper@php.net
Yes, it skips whitespace when you set it to 1.
Otherwise it will not skip it, it's left as is.
I could not find the documentation for these options
(on the page for xml_parser_set_option()):
XML_OPTION_SKIP_WHITE
XML_OPTION_SKIP_TAGSTART
even as they seem to have existed since PHP 3? :)
------------------------------------------------------------------------
[2005-06-03 22:50:41] jacob at jacobweber dot com
Description:
------------
Turning on XML_OPTION_SKIP_WHITE causes the space in the following XML
to be skipped:
<a>' &</a>
I believe this is incorrect. It doesn't skip the space in:
<a>& '</a>
Jacob
Reproduce code:
---------------
$xmlStr = "<a>' &</a>";
$xmlParser = xml_parser_create();
xml_parser_set_option($xmlParser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($xmlParser, $xmlStr, $xmlArr);
xml_parser_free($xmlParser);
print_r($xmlArr);
Expected result:
----------------
Array
(
[0] => Array
(
[tag] => A
[type] => complete
[level] => 1
[value] => ' &
)
)
Actual result:
--------------
Array
(
[0] => Array
(
[tag] => A
[type] => complete
[level] => 1
[value] => '&
)
)
(note the missing space after the apostrophe
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33240&edit=1