Reputation: 133
Can someone check a xml reply string. User said it is not XML compatible and has bad header. When I do a view source, I see this
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response><task_no_added>54</task_no_added><errorMessage></errorMessage></response>
http://itpscan.info/XML/add_item.php
Here is header info found in firebug...
Response Headersview source
Date Sun, 03 Oct 2010 22:50:03 GMT
Server Apache mod_fcgid/2.3.5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
X-Powered-By PHP/5.2.13
Keep-Alive timeout=5, max=100
Connection Keep-Alive
Transfer-Encoding chunked
Content-Type text/html
Request Headersview source
Host itpscan.info
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Connection keep-alive
Referer http://xxxxxx.info/XML/add_item.php
Addition: I tried adding a xml header, we will see if that works now...
header ("Content-Type:text/xml");
$xml_writer = new XMLWriter();
$xml_writer->openMemory();
$xml_writer->startDocument('1.0', 'UTF-8', 'yes');
$xml_writer->startElement('response');
Upvotes: 1
Views: 368
Reputation: 60942
This is valid XML. You can verify it yourself here.
Your user's software may be tripped up by the header's standalone
attribute, which is uncommon, but legal:
Markup declarations can affect the content of the document, as passed from an XML processor to an application; examples are attribute defaults and entity declarations. The standalone document declaration, which may appear as a component of the XML declaration, signals whether or not there are such declarations [...]
You can just remove it, or convince your serializer to not generate it, if your user is implacable.
EDIT: Looking at the HTTP headers, I'd try a Content-Type of text/xml
rather than text/html
(assuming that the XML you posted is all you're sending in the body).
Upvotes: 1