Bug #1

Recommend this page to a friend!

      XmlNode  >  All threads  >  Bug #1  >  (Un) Subscribe thread alerts  
Subject:Bug #1
Summary:There is a bug in this class, but i know how to solve
Author:Julio Cezar Novais Raffaine
Date:2007-06-21 15:14:51

  1. Bug #1   Reply   Report abuse  
Julio Cezar Novais Raffaine - 2007-06-21 15:14:52
Hi everybody, i loved this class, it is very usefull for me cause i don't have DOM Xml in my host. But there is a simple bug in this class.
When you have a text with line breaks (like a text in a text area) the text is trown away by the class, only the last part remains.
comeca aqui
e termina aqui

After being processed by the class:
e termina aqui

This is a simple problem, when we have multiple lines, the xmlexpat invoke XmlCharacterData once per line. In the code we can notice that in XmlCharacterData he put this code:
if (strlen($text)>0) $XmlRootNode[$XmlParentId]->text=$text;
We just need to change it a little bit:

if(strlen($XmlRootNode[$XmlParentId]->text)>0) {
if (strlen($text)>0) $XmlRootNode[$XmlParentId]->text .= $text;
if (strlen($text)>0) $XmlRootNode[$XmlParentId]->text=$text;

In this code i verify if there is some text added, if there is the text I add the final part of the string, else I create a new one.



For more information send a message to info at phpclasses dot org.