Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.5.2

Bug #3195 White space is considered as PCDATA
Submitted: 2005-01-13 22:53 UTC
From: ylf at xung dot org Assigned: ifeghali
Status: Closed Package: XML_DTD
PHP Version: 4.3.4 OS: Linux Debian
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 45 - 9 = ?

 
 [2005-01-13 22:53 UTC] ylf at xung dot org
Description: ------------ The reference tool xmllint (http://xmlsoft.org) does not issue a single warning when validating my files, whereas XML_DTD dumps several pages of errors. It looks like the xml parser is not correctly set up, treating white space between tags as CDATA. xml file : http://samalyse.com/ln/0005.php dtd file : http://samalyse.com/ln/0006.php Reproduce code: --------------- <?php require 'XML/DTD/XmlValidator.php'; $validator =& new XML_DTD_XmlValidator(); echo "Performing DTD validation : "; $test = $validator->isValid('i18n.dtd', 'i18n.xml'); if ($test) { echo "OK\n"; } else { exit ("FAILED : " . $validator->getMessage() . "\n"); } ?> Expected result: ---------------- Performing DTD validation : OK Actual result: -------------- Performing DTD validation : FAILED : line 22: <#PCDATA> not allowed under <translation2> line 78: <#PCDATA> not allowed under <translation2> line 23: <#PCDATA> not allowed under <languages> (repeated 8 times with different line numbers) line 24: <#PCDATA> not allowed under <lang> (repeated 35 times with different line numbers) line 79: <#PCDATA> not allowed under <pages> line 140: <#PCDATA> not allowed under <pages> line 207: <#PCDATA> not allowed under <pages> line 80: <#PCDATA> not allowed under <page> (repeated 6 times with different line numbers) line 81: <#PCDATA> not allowed under <string> (repeated 44 times with different line numbers) line 141: <#PCDATA> not allowed under <page> (repeated 6 times with different line numbers) line 142: <#PCDATA> not allowed under <string> (repeated 51 times with different line numbers) line 208: <#PCDATA> not allowed under <page> (repeated 172 times with different line numbers) line 209: <#PCDATA> not allowed under <string> (repeated 172 times with different line numbers)

Comments

 [2005-01-19 15:39 UTC] cmoulin at simplerezo dot com
Having the same behaviour, i have found how to fix. Just apply following patch into XML/DTD directory: --- XmlValidator.php.orig Wed Jan 19 16:37:34 2005 +++ XmlValidator.php Wed Jan 19 16:37:02 2005 @@ -99,7 +99,8 @@ foreach ($node->children as $child) { // a text node if (!strlen($child->name)) { - $children[] = '#PCDATA'; + if (strlen(trim($child->content))) + $children[] = '#PCDATA'; } else { $children[] = $child->name; }
 [2005-01-23 19:38 UTC] ylf at xung dot org
Downgrading XML_Tree from 2.0.0RC2 (beta) to 1.1 (stable) seems to fix this issue. Check the following bugs : http://pear.php.net/bugs/1575 http://pear.php.net/bugs/2457
 [2005-02-25 17:05 UTC] schst
This is caused by a BC-break in XML_Tree. I'll upload a new release, when the XML_Tree issues are resolved.
 [2005-04-20 20:22 UTC] smith at backendmedia dot com
whats the status of this bug?
 [2005-04-20 20:56 UTC] ojai at nerim dot net
Well, it looks : open. Or in a more verbose manner, it's : waiting for XML_Tree authors to decide how they want to handle whitespace. For now just downgrade XML_Tree, you'll be fine.
 [2006-10-01 19:49 UTC] arnaud (Arnaud Limbourg)
Until the package gets a new maintainer.
 [2009-01-18 22:50 UTC] ifeghali (Igor Feghali)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.