#28318 [Fbk->Csd]: Line feed characters removed
| From: | dev at glossword dot info | Date: | Fri, 07 May 2004 18:06:34 +0000 |
| Subject: | #28318 [Fbk->Csd]: Line feed characters removed | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-59372@lists.php.net to get a copy of this message | ||
ID: 28318
User updated by: dev at glossword dot info
Reported By: dev at glossword dot info
-Status: Feedback
+Status: Closed
Bug Type: XML related
Operating System: Windows XP
PHP Version: 4.3.6
New Comment:

 works great. Thanks. Not a bug.
Previous Comments:
------------------------------------------------------------------------
[2004-05-07 19:45:09] amt@php.net
I believe this is the correct behavior according to the
XML specification. See:
http://www.w3.org/TR/REC-xml/#AVNormalize
To preserve line feeds, you should either wrap your
attribute values inside a CDATA section or use entities,
like 
.
------------------------------------------------------------------------
[2004-05-07 19:29:49] dev at glossword dot info
Description:
------------
Line feed characters has beed accidentally removed from a tag
attributes.
Reproduce code:
---------------
$string = "<a title=\" 123 \n 456 \r\n 789 \">link</a>";
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
xml_parse_into_struct($parser, $string, $values, $tags);
xml_parser_free($parser);
print '<pre>';
print_r( $values );
print '</pre>';
Expected result:
----------------
I expect to keep all line feed characters in attributes.
Better if it could be possible add a special option
for xml_parser, like
xml_parser_set_option($parser, XML_OPTION_KEEP_LF, 1);
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28318&edit=1