【发布时间】:2013-12-17 13:02:47
【问题描述】:
我想通过 JSON 将结果输入到 jquery 数据表中。 该页面是用 JSP 编写的。
该表包含一个带有 XML 字符串的特殊字段:
{
"sEcho": 1,
"iTotalRecords": "3800",
"iTotalDisplayRecords": "3800",
"aaData": [ [ "16.12.2013 14:14:55 GMT",
"Unknown",
"Unknown",
"",
"26414321279",
"ci1387203295280.36875276@czchols2138_te",
"<?xml version="1.0" encoding="UTF-8"?> <ExtendedEventContent> <Transport_Failure> <Error>Incomplete data received</Error> <Transport_Error>com.cyclonecommerce.tradingengine.transport.FileNotFoundException: 550 TEST.xml: The system cannot find the file specified. ; command=RETR TEST.xml</Transport_Error> </Transport_Failure> </ExtendedEventContent> ",
"" ] ,
...
数据表启动脚本:
<script>
$(document).ready(function() {
$('#failedDetails').dataTable( {
"bStateSave": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "./inc_failed_details_json.jsp",
"aLengthMenu": [[10, 50, 100, -1], [10, 50, 100, "All"]],
"iDisplayLength": 10,
"aaSorting": [[ 0, "asc" ]]
} );
});
我当然收到错误:
...无法解析来自服务器的 JSON 数据。这是由 JSON 格式错误引起的。
数据是从 Oracle DB 收集的。 我尝试使用以下方式替换 XML 值:
(select replace(max(details), '"', '\"') from cyclone.messageevents where messageoid = m.oid) Details,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?> <ExtendedEventContent> <Reason> <Event>Messaging.Message.Duplicate.Message</Event> </Reason> </ExtendedEventContent> "
但结果相同。
有没有人可以提供帮助?
【问题讨论】:
标签: jquery xml json datatables