[xml] BUG?

Title: BUG?

I am using libxml2  and Xpath  to  parse through HTML
to  find all <script> elements   and remove   them

If the <script> is inside  of another tag (like a <div> or a <span>   AND  the  script has a single  quoted string that also has the same tag  (a <div> or a <span>)  inside of  the quotes  , then the  <script> tag does not get properly removed.  It only gets removed up to the  <div> or <span> that’s inside the quoted string.

Here is an example of the HTML  and after it,  the   parsed result. You can see there is a remnant of the quoted string that’s inside the <script>  that appears in the parsed output.

<h1><<br>PROBLEM CASE<br><h1>
<script language="_javascript_">

        document.write('<span>Shop Products</span>');


<?xml version="1.0" standalone="yes"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
    <link rel="stylesheet" type="text/css" href="" media="all"/>
    <h1>&lt;<br/>PROBLEM CASE<br/></h1>


<span>Shop Products</span>


Can this be fixed?  Could someone validate that it is indeed a BUG?

Thank You!!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]