Home » XML » XML_HTMLSax » Bug #6706
code fails on blockquote tag, thinks its bold tag
Details
| Submitted | 2006-02-06 12:31 UTC |
|---|---|
| From | joeofclew at yahoo dot com |
| Status | No Feedback |
| Package | XML_HTMLSax |
| PHP Version | 4.4.2 |
| OS | fedora 4 |
| Roadmaps | (Not assigned) |
Comments
[2006-02-06 12:31 UTC] joeofclew at yahoo dot com
Description:
------------
stable release from 2004/ december
I get this in the output from the parser when looking at the source
<blockquote >
some text
</b >
<//b>
ockquote>
/p>
p>Yu ... more text
</p><p> >
<//p><p>>
myHandler class is simple. Basically, i don't want to process anything between <a ... /a> tags, but the rest goes for special processing.
function openHandler(& $parser,$name,$attrs) { // copy html as is
if ( (isset ( $attrs['id'] ) && $attrs['id'] == 'title') || !strcasecmp($name,'title') ) // example
$this->inTitle=true;
// if ( array_key_exists('href',$attrs) && !strcasecmp($name,'a') ) {
if ( strcasecmp($name,'a')==0 ) {
// echo "inA true***data***$data***<br>";
$this->inA=true;
}
$this->current_tag = $name;
$this->write_me .= "<" . $name.' ';
foreach ($attrs as $key=>$value) {
// Watch for 'checked' -- next 2 from the example
if ( $key == 'checked' ) {
$this->write_me.=' checked="checked"';
// Watch for 'selected'
} else if ( $key == 'selected' ) {
$this->write_me .=' selected="selected"';
} else {
$this->write_me .=' '.$key.'="'.$value.'"';
}
}
if ($this->inA) $this->write_me .= " class='realLink' "; // to differentiate from sideviews and overlibs
$this->write_me .= ">\n";
}
function closeHandler(& $parser,$name) {
$this->current_tag = '';
if ($this->inTitle) $this->inTitle=false;
if ($this->inA) $this->inA=false;
$this->write_me .= "</".$name.">\n";
}
function get_write_me() {
$rv = $this->write_me;
$this->write_me = '';
return $rv;
}
function dataHandler(& $parser,$data) {
if ($this->inTitle || $this->inA) {
$this->write_me .= $data;
}
else if (stripos($data,"img ") !== false) { $this->write_me .= $data; } // bug in parser?
else $this->write_me .= write_sideviewed($this->from_lang,$data,0); // last arg says convert from & -> &
Test script:
---------------
an rss feed. need change back to html chars first....
<blockquote>"Creative Commons is one of the tools that local musicians can use to protect their works. But it?? just a form of licensing; how you create your music, how you market yourself, how you help create a better, more diverse scene, and how you help others will be the things that make a difference to the local music scene."</blockquote></p>
Expected result:
----------------
</blockquote></p>
Actual result:
--------------
</b >
<//b>
ockquote>
/p>
p>Yu ... more text
</p><p> >
<//p><p>>