Connecting Tech Pros Worldwide Forums | Help | Site Map

Best way to output xml from php?

Brian Lee
Guest
 
Posts: n/a
#1: Jan 28 '06
I've been googling for a few hours now and I can't seem to find any
tutorials on the best way to generate xml from php... most tutorials
tell you how to pase incoming xml xml. I'm used to using template to
output HTML to the browser but I want to start playing with ajax and
outputting XML to the browser anyone have any suggestions or links to
tutorials?

-Brian


Tim Van Wassenhove
Guest
 
Posts: n/a
#2: Jan 28 '06

re: Best way to output xml from php?


On 2006-01-28, Brian Lee <brianleee@gmail.com> wrote:[color=blue]
> I've been googling for a few hours now and I can't seem to find any
> tutorials on the best way to generate xml from php... most tutorials
> tell you how to pase incoming xml xml. I'm used to using template to
> output HTML to the browser but I want to start playing with ajax and
> outputting XML to the browser anyone have any suggestions or links to
> tutorials?[/color]

Doing it the exact same way as you do now for html seems most
appropriate to me.

--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be>
Carl Vondrick
Guest
 
Posts: n/a
#3: Jan 28 '06

re: Best way to output xml from php?


Brian Lee wrote:[color=blue]
> I've been googling for a few hours now and I can't seem to find any
> tutorials on the best way to generate xml from php... most tutorials
> tell you how to pase incoming xml xml. I'm used to using template to
> output HTML to the browser but I want to start playing with ajax and
> outputting XML to the browser anyone have any suggestions or links to
> tutorials?[/color]

Just do it the same way as you do with HTML.

But, you should always output this FIRST:

<?php
header('Content-Type: text/xml');
print '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
?>
Darkstar 3D
Guest
 
Posts: n/a
#4: Jan 29 '06

re: Best way to output xml from php?


Since your are just getting started, use the DOM. It may seem like more
coding at first, but it well worth it in the long haul. If PHP5,
simpleXML is pretty cool too.

Tony Marston
Guest
 
Posts: n/a
#5: Jan 29 '06

re: Best way to output xml from php?


If you want some examples of creating XML from PHP then take a look at
http://www.tonymarston.co.uk/php-mysql/domxml.html for PHP 4
http://www.tonymarston.co.uk/php-mysql/dom.html for PHP 5

--
Tony Marston

http://www.tonymarston.net



"Brian Lee" <brianleee@gmail.com> wrote in message
news:2006012812482316807-brianleee@gmailcom...[color=blue]
> I've been googling for a few hours now and I can't seem to find any
> tutorials on the best way to generate xml from php... most tutorials tell
> you how to pase incoming xml xml. I'm used to using template to output
> HTML to the browser but I want to start playing with ajax and outputting
> XML to the browser anyone have any suggestions or links to tutorials?
>
> -Brian
>[/color]


Closed Thread