Although we have declared the content as XML, we have
not declared the document header MIME type as text/xml. To do this we use the
document setMimeEncoding() method:
$document =& JFactory::getDocument();
$document->setMimeEncoding('text/xml');
We're now ready to take a look at our XML response. We can do this by simply
adding the string &format=raw to the end or our URI query string when viewing an
item. This tells Joomla! that we want to use the RAW document and that we want to
use the view class held in the view.raw.php file.
This is a screenshot of the resultant XML when we perform the request:
One important thing to notice here is the use of the XHTML paragraph tag within
the text node. The paragraph tag is part of the text value within the database,
but the XML doesn't treat it as an XML node. This is because when we use the
JSimpleXMLElement toString() method, node data is automatically encoded.
Request
AJAX requests hinge on the JavaScript XMLHttpRequest class. This class is used to
perform HTTP requests.
Pages:
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393