开发者

HTML page shows data that is not in the file

开发者 https://www.devze.com 2023-01-06 00:26 出处:网络
I created a C++ program that parses a file and dumps some data into a html file. The output is as follows:

I created a C++ program that parses a file and dumps some data into a html file. The output is as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Block 0xa8</title></head>
<body>
<h1>Block 0xa8</h1>
<table>
    <tr>
        <td>02        </td>
        <td>00        </td>
        <td>00        </td>
        <td>00        </td>
        <td>00        </td>
        <td>00        </td>
        <td>00        </td>
        <td>00        </td>
        <td>b0        </td>
        <td>75        </td>
        <td>05        </td>
        <td>00        </td>
        <td>00        </td>
        <td>00        </td>
        <td>00        </td>
        <td>00        </td>
        <td><td>  </td>.        </td>
        <td>.        </td>
        <td>.        </td>
        <td>.        </td>
        <td>.        </td>
        <td>.        </td>
        <td>.        </td>
        <td>.        </td>
        <td>.        </td>
        <td>u        </td>
        <td>.        </td>
       开发者_JAVA百科 <td>.        </td>
        <td>.        </td>
        <td>.        </td>
        <td>.        </td>
        <td>.        </td>
    </tr>
</table>
</body>
</html>

If you open this page with a browser, you'll see one single dot before the table. This dot is a random character and it appears for each row. I don't want this character - how can I get rid of it? What am I doing wrong? (Tested with Firefox, IE, Chrome).


Because you have a syntax error (<td>s cannot be directly nested):

<td>00        </td>
<td><td>  </td>.        </td>      // <-- here
<td>.        </td>

The DOM parser corrects this and puts the dot before the table because it does not know where to put it ;)

Check your C++ application and fix this.


You have a unmatched tags in this line:

<td><td>  </td>.        </td>

You should change it to read:

<td></td>  <td>.        </td>

There is probably a bug in your parser that doesn't take into account for nil values.

0

精彩评论

暂无评论...
验证码 换一张
取 消