fee Posted May 19, 2006 Share Posted May 19, 2006 I'm creating an XML data dynamically (PHP script) after selecting an option in HTML <select>. Next I want to parse this XML data in some way.I was trying to do it using only XML DOM but in that case I had to run PHP to generate XML file, save this file on a server and the load it by XML DOM function to make it all work.I want to ommit saving this file and pass data using httpXMLRequest - requesting PHP 'XML generating script' and getting XML date as an answer.It seems it doesn't work...I want to have this: http://www.w3schools.com/xml/tryit.asp?fil...httprequest_js4but changing: <body onLoad="loadXMLDoc('cd_catalog.xml');"> to: <body onLoad="loadXMLDoc('localhost/mag/generate-xml.php');"> generate-xml.php (it's simplified for this post, actually data is taken from DB): <?phpprint ('<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n");print ('<list>' . "\n");print ('<listitem>' . "\n");print ('<id>1</id>' . "\n");print ('<text>jeden</text>' . "\n");print ('</listitem>' . "\n"); print ('<listitem>' . "\n");print ('<id>2</id>' . "\n");print ('<text>dwa</text>' . "\n");print ('</listitem>' . "\n"); print ('</list>');?> Can I do it? Maybe there is other way to do it? Link to comment Share on other sites More sharing options...
fee Posted May 19, 2006 Author Share Posted May 19, 2006 generate-xml.php (it's simplified for this post, actually data is taken from DB):<?phpprint ('<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n");print ('<list>' . "\n");...print ('</list>');?> Done it! I had to add:header("Content-Type: application/xml; charset=iso-8859-2"); before sending XML data... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now