开发者

Ajax parse xml file generated by php

I am trying to generate xml file from php for ajax response. but when i try to access it i got this error


XML Parsing Error: XML or text d开发者_Python百科eclaration not at start of entity Location: moz-nullprincipal:{4f5dba1b-4a28-4fb0-8114-8c3c3f6ea485} Line Number 3, Column 1:



Based on that error, I would assume you have leading whitespace in your XML, or your are simply outputting a completely broken XML format (no root or something).

If you are outputting XML, it would be advisable for you to use PHP's DOM Document and related methods rather than "manually" build it with some echos or templates. Anytime you output a data format which has strict specifications (such as XML, JSON, etc) you should use mechanisms which properly build such formats (DOM Document, json_encode, etc).

Beyond this advice, we must see your XML generation code, and the output itself, before we can really tell you something specific.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜