XML解析错误:PHP XML文件中的标记不匹配

时间:2015-12-22 12:59:43

标签: php mysql xml

我有以下PHP文件。

<?php
    header('Content-Type: text/xml');
    echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
    session_start();
    echo '<response>';
    $email = $_GET['person'];
    $UserEmail = $_SESSION['login'];

    $conn = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
    mysql_select_db(DB_DATABSE, $conn);

    $sql_find = mysql_query("SELECT * FROM Users WHERE UserEmail='".$email."' LIMIT 1");

    if(mysql_fetch_array($sql_find)) {
        $sql_add = "UPDATE Users SET Contacts = concat(Contacts, ';', '".$email."') WHERE UserEmail = '".$UserEmail."'";
        if (mysql_query($conn, $sql_add)) {
           echo array( 'found' => true, 'msg' => "Person added to your record");
        } 
        else {
           echo array( 'found' => false, 'msg' => "Error adding person to your record \n Is the person emails' correct?");
        }

    }
    else {
        echo array( 'found' => false, 'msg' => "We couldn't find the user in our databases.");
    }

    echo '</response>';
?>

我使用Ajax将数据添加到MySql并将结果返回给前端。问题是,即使SQL代码在我测试我的服务器PhPAdmin时工作,它也会显示以下错误:

XML Parsing Error: mismatched tag. Expected: </br>.
Location: http://secretsea.comli.com/lib/addPerson.php
Line Number 3, Column 261:<br><table border='1' cellpadding='2' bgcolor='#FFFFDF' bordercolor='#E8B900' align='center'><tr><td><div align='center'><a href='http://www.000webhost.com/'><font face='Arial' size='1' color='#000000'>Free Web Hosting</font></a></div></td></tr></table>Array</response>
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^

我试图在网站和其他资源上找到解决方案,但我无法理解我做错了什么。我的语法错了吗?

2 个答案:

答案 0 :(得分:1)

public class ReportRunnerJob implements Job { @Autowired private SessionFactory sessionFactoryReporting; @Autowired private JdbcTemplate jdbcTemplateReporting; @Autowired private MailService mailService;*/ @Context private HttpServletRequest request; public void execute(JobExecutionContext context) throws JobExecutionException { System.out.println("Schedular job started"); } } 只会打印字符串echo array(...) 您发布的代码不会产生输出

Array

可能是您的免费网络托管服务商添加了一些广告。糟糕,但更糟糕的是,它不适合XML,因为<br ><table border='1' cellpadding='2' bgcolor='#FFFFDF' bordercolor=... 应该<br>符合xml。

答案 1 :(得分:1)

因为<ImageBrush ImageSource="pack://application:,,,/CINTRA 2016;CINTRA2016"/>不是有效标记。您必须编写</br>以与xml兼容。

重复的问题是https://stackoverflow.com/a/1946442/4536186